diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-03-13 12:49:28 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-03-13 12:49:28 +0000 |
commit | f3ce86ccdb95ffcd5e66e16e07f63d5a09b8d83d (patch) | |
tree | b6c2bf287235f3624d82935a3c836205ddc90472 /src/gui | |
parent | 17a46d8ff6cff4017bf830748fd8e1f65cebb47a (diff) | |
download | fpGUI-f3ce86ccdb95ffcd5e66e16e07f63d5a09b8d83d.tar.xz |
* Applied patch from Antonio which adds a authentication to User Prompt Dialog and added a DB login dialog.
* Minor fixes to the user prompt dialog Wiggle method.
* Minor fix to TfpgWindowBase.MoveWindow method.
* Extended filedialog demo to show an example usage of DB Login Dialog.
* Updated the rest of the lang_XXX.inc files with new resource string.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/fpgui_package.lpk | 5 | ||||
-rw-r--r-- | src/gui/gui_dialogs.pas | 1 | ||||
-rw-r--r-- | src/gui/promptuserdialog.inc | 108 |
3 files changed, 96 insertions, 18 deletions
diff --git a/src/gui/fpgui_package.lpk b/src/gui/fpgui_package.lpk index 0fc84c46..727594b7 100644 --- a/src/gui/fpgui_package.lpk +++ b/src/gui/fpgui_package.lpk @@ -17,11 +17,6 @@ <CodeGeneration> <Generate Value="Faster"/> </CodeGeneration> - <Linking> - <Debugging> - <GenerateDebugInfo Value="True"/> - </Debugging> - </Linking> <Other> <CustomOptions Value="-B "/> diff --git a/src/gui/gui_dialogs.pas b/src/gui/gui_dialogs.pas index 660eb1e7..1437a492 100644 --- a/src/gui/gui_dialogs.pas +++ b/src/gui/gui_dialogs.pas @@ -211,6 +211,7 @@ uses {$IFDEF MSWINDOWS} ,Windows // used by File Dialog {$ENDIF} + ,DateUtils ; diff --git a/src/gui/promptuserdialog.inc b/src/gui/promptuserdialog.inc index ccb04a94..9c5e5d0f 100644 --- a/src/gui/promptuserdialog.inc +++ b/src/gui/promptuserdialog.inc @@ -5,19 +5,36 @@ { TfpgPromptUserDialog } -TfpgPromptUserDialog = class(TfpgBaseDialog) -private - lblTitle: TfpgLabel; - lblTitlePw: TfpgLabel; - edUserID: TfpgEdit; - edPassword: TfpgEdit; - function GetUserID: TfpgString; - function GetUserPassword: TfpgString; -public - constructor Create(AOwner: TComponent); override; - property UserID: TfpgString read GetUserID; - property Password: TfpgString read GetUserPassword; -end; + TfpgPromptUserDialog = class(TfpgBaseDialog) + private + lblTitle: TfpgLabel; + lblTitlePw: TfpgLabel; + edUserID: TfpgEdit; + edPassword: TfpgEdit; + function GetUserID: TfpgString; + function GetUserPassword: TfpgString; + public + constructor Create(AOwner: TComponent); override; + // Gof defines this Authenticate method a Hook operation in Template methods pattern. + // Subclass will have to override and implement it. By default it returns True. + function Authenticate: boolean; virtual; + procedure Wiggle(const Seconds: integer = 1; const MovingPixels: integer = 5; const aSleep: integer = 75); + property UserID: TfpgString read GetUserID; + property Password: TfpgString read GetUserPassword; + end; + + + TfpgPromptUserDbDialog = class(TfpgPromptUserDialog) + private + lblDatabases: TfpgLabel; + protected + aStringList: TStringList; + cbDatabases: TfpgComboBox; + procedure PopulateComboDb; virtual; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + end; {$ENDIF read_interface} @@ -70,6 +87,71 @@ begin btnCancel.TabOrder := 4; end; +function TfpgPromptUserDialog.Authenticate: boolean; +begin + Result := True; +end; + +procedure TfpgPromptUserDialog.Wiggle(const Seconds: integer; const MovingPixels: integer; const aSleep: integer); +var + MyTime: TDateTime; +begin + MyTime := Now; + repeat + MoveWindow(Left - MovingPixels, Top); + fpgApplication.ProcessMessages; + Sleep(aSleep); + MoveWindow(Left + MovingPixels * 2, Top); + fpgApplication.ProcessMessages; + Sleep(aSleep); + MoveWindow(Left - MovingPixels, Top); + fpgApplication.ProcessMessages; + until SecondsBetween(Now, MyTime) >= Seconds; +end; + +{ TfpgPromptUserDbDialog } + +constructor TfpgPromptUserDbDialog.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + // reset dimensions + Width := 200; + Height := 185; + MinWidth := 200; + MinHeight := 185; + + aStringList := TStringList.Create; + + lblDatabases := CreateLabel(self, 8, 101, rsDatabase); + cbDatabases := CreateComboBox(self, 8, 119, 184, aStringList); + cbDatabases.Anchors := [anLeft, anTop, anRight]; + + // reposition buttons + btnCancel.Left := Width-FDefaultButtonWidth-FSpacing; + btnCancel.Top := Height - FSpacing - btnCancel.Height; + btnOK.Left := btnCancel.Left-FDefaultButtonWidth-FSpacing; + btnOK.Top := btnCancel.Top; + + // now reset tab order + edUserID.TabOrder := 1; + edPassword.TabOrder := 2; + cbDatabases.TabOrder := 3; + btnOK.TabOrder := 5; + btnCancel.TabOrder := 6; + + PopulateComboDb; +end; + +destructor TfpgPromptUserDbDialog.Destroy; +begin + aStringList.Free; + inherited Destroy; +end; + +procedure TfpgPromptUserDbDialog.PopulateComboDb; +begin + // do nothing. Derived classe will implement it +end; {$ENDIF read_implementation} |