1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
unit dlgrestfieldoptions;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, ButtonPanel, sqldbrestschema;
type
{ TRestFieldOptionsDialog }
TRestFieldOptionsDialog = class(TForm)
BPFieldOptions: TButtonPanel;
CGFieldOptions: TCheckGroup;
private
function GetOptions: TRestFieldOptions;
procedure Setoptions(AValue: TRestFieldOptions);
public
Property Options : TRestFieldOptions Read GetOptions Write Setoptions;
end;
Function GetRestFieldOptions(var aOptions : TRestFieldOptions) : Boolean;
implementation
Function GetRestFieldOptions(var aOptions : TRestFieldOptions) : Boolean;
begin
With TRestFieldOptionsDialog.Create(Application) do
try
Options:=aOptions;
Result:=ShowModal=mrOK;
if Result then
aOptions:=Options;
finally
Free;
end;
end;
{$R *.lfm}
function TRestFieldOptionsDialog.GetOptions: TRestFieldOptions;
Procedure DoOption(O : TRestFieldOption);
begin
if CGFieldOPtions.Checked[Ord(O)] then
Include(Result,O);
end;
Var
O : TRestFieldOption;
begin
Result:=[];
For O in TRestFieldOption do
DoOption(O);
end;
procedure TRestFieldOptionsDialog.Setoptions(AValue: TRestFieldOptions);
Procedure DoOption(O : TRestFieldOption);
begin
CGFieldOptions.Checked[Ord(O)]:=O in aValue;
end;
Var
O : TRestFieldOption;
begin
For O in TRestFieldOption do
DoOption(O);
end;
end.
|