summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-13 12:49:28 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-13 12:49:28 +0000
commitf3ce86ccdb95ffcd5e66e16e07f63d5a09b8d83d (patch)
treeb6c2bf287235f3624d82935a3c836205ddc90472 /examples
parent17a46d8ff6cff4017bf830748fd8e1f65cebb47a (diff)
downloadfpGUI-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 'examples')
-rw-r--r--examples/gui/filedialog/filedialog.lpr42
1 files changed, 39 insertions, 3 deletions
diff --git a/examples/gui/filedialog/filedialog.lpr b/examples/gui/filedialog/filedialog.lpr
index c85e8cdc..29635dbb 100644
--- a/examples/gui/filedialog/filedialog.lpr
+++ b/examples/gui/filedialog/filedialog.lpr
@@ -7,6 +7,7 @@ uses
cthreads,
{$ENDIF}{$ENDIF}
Classes,
+ gfxbase,
fpgfx,
gui_form,
gui_dialogs,
@@ -39,6 +40,37 @@ type
public
procedure AfterCreate; override;
end;
+
+
+ TMyDBLoginDlg = class(TfpgPromptUserDbDialog)
+ private
+ function GetDatabase: TfpgString;
+ protected
+ procedure PopulateComboDb; override;
+ public
+ property Database: TfpgString read GetDatabase;
+ end;
+
+{ TMyDBLoginDlg }
+
+function TMyDBLoginDlg.GetDatabase: TfpgString;
+begin
+ Result := aStringList.ValueFromIndex[cbDatabases.FocusItem-1];
+end;
+
+procedure TMyDBLoginDlg.PopulateComboDb;
+var
+ i: integer;
+begin
+ aStringList.Clear;
+ aStringList.Add('Database1=192.168.0.1:/data/db1.gdb');
+ aStringList.Add('Database2=192.168.0.10:/data/live.gdb');
+ aStringList.Add('Database3=192.168.0.150:/data/sometest.gdb');
+ aStringList.Add('Database4=192.168.0.200:c:\MyData\test.gdb');
+ cbDatabases.Items.Clear;
+ for i := 0 to aStringList.Count-1 do
+ cbDatabases.Items.Add(aStringList.Names[i]);
+end;
{@VFD_NEWFORM_DECL}
@@ -46,14 +78,18 @@ type
procedure TMainForm.btnUserPromptClick(Sender: TObject);
var
- dlg: TfpgPromptUserDialog;
+ dlg: TMyDBLoginDlg;
begin
- dlg := TfpgPromptUserDialog.Create(nil);
+ dlg := TMyDBLoginDlg.Create(nil);
try
dlg.WindowTitle := 'Sample Login';
if dlg.ShowModal = 1 then
begin
- TfpgMessageDialog.Information('User Results', 'User=' + dlg.UserID + #13#10 + 'Pass='+ dlg.Password, [mbOK]);
+ TfpgMessageDialog.Information('User Results',
+ 'User=' + dlg.UserID + #13 +
+ 'Pass=' + dlg.Password + #13 +
+ 'Database=' + dlg.Database, [mbOK]);
+ fpgApplication.ProcessMessages;
end;
finally
dlg.Free;