summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/gui/filedialog/filedialog.lpr36
-rw-r--r--src/corelib/lang_afrikaans.inc5
-rw-r--r--src/corelib/lang_english.inc5
-rw-r--r--src/corelib/lang_french.inc5
-rw-r--r--src/corelib/lang_german.inc5
-rw-r--r--src/corelib/lang_italian.inc4
-rw-r--r--src/corelib/lang_portuguese.inc5
-rw-r--r--src/corelib/lang_russian.inc5
-rw-r--r--src/corelib/lang_spanish.inc5
-rw-r--r--src/gui/fpgui_package.lpk14
-rw-r--r--src/gui/gui_dialogs.pas7
-rw-r--r--src/gui/messagedialog.inc4
-rw-r--r--src/gui/promptuserdialog.inc75
13 files changed, 166 insertions, 9 deletions
diff --git a/examples/gui/filedialog/filedialog.lpr b/examples/gui/filedialog/filedialog.lpr
index 28d0ca26..c85e8cdc 100644
--- a/examples/gui/filedialog/filedialog.lpr
+++ b/examples/gui/filedialog/filedialog.lpr
@@ -28,12 +28,14 @@ type
btnQuit: TfpgButton;
btnName1: TfpgButton;
btnName2: TfpgButton;
+ btnUserPrompt: TfpgButton;
{@VFD_HEAD_END: MainForm}
procedure btnQuitClick(Sender: TObject);
procedure btnOpenFileClick(Sender: TObject);
procedure btnSaveFileClick(Sender: TObject);
procedure btnMessageBoxClick(Sender: TObject);
procedure btnMessageDlgClick(Sender: TObject);
+ procedure btnUserPromptClick(Sender: TObject);
public
procedure AfterCreate; override;
end;
@@ -42,6 +44,22 @@ type
{ TMainForm }
+procedure TMainForm.btnUserPromptClick(Sender: TObject);
+var
+ dlg: TfpgPromptUserDialog;
+begin
+ dlg := TfpgPromptUserDialog.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]);
+ end;
+ finally
+ dlg.Free;
+ end;
+end;
+
procedure TMainForm.btnQuitClick(Sender: TObject);
begin
Close;
@@ -107,6 +125,7 @@ begin
Text := 'Open File...';
FontDesc := '#Label1';
ImageName := '';
+ TabOrder := 1;
OnClick := @btnOpenFileClick;
end;
@@ -118,6 +137,7 @@ begin
Text := 'Save File...';
FontDesc := '#Label1';
ImageName := '';
+ TabOrder := 2;
OnClick := @btnSaveFileClick;
end;
@@ -127,6 +147,7 @@ begin
Name := 'edFilename';
SetPosition(8, 70, 400, 24);
Anchors := [anLeft,anRight,anTop];
+ TabOrder := 2;
Text := '';
FontDesc := '#Edit1';
end;
@@ -140,6 +161,7 @@ begin
Text := 'Quit';
FontDesc := '#Label1';
ImageName := 'stdimg.Quit';
+ TabOrder := 6;
OnClick := @btnQuitClick;
end;
@@ -151,6 +173,7 @@ begin
Text := 'Message Box';
FontDesc := '#Label1';
ImageName := '';
+ TabOrder := 3;
OnClick := @btnMessageBoxClick;
end;
@@ -162,9 +185,22 @@ begin
Text := 'Message Dialog';
FontDesc := '#Label1';
ImageName := '';
+ TabOrder := 4;
OnClick := @btnMessageDlgClick;
end;
+ btnUserPrompt := TfpgButton.Create(self);
+ with btnUserPrompt do
+ begin
+ Name := 'btnUserPrompt';
+ SetPosition(272, 40, 131, 24);
+ Text := 'User Prompt';
+ FontDesc := '#Label1';
+ ImageName := '';
+ TabOrder := 5;
+ OnClick := @btnUserPromptClick;
+ end;
+
{@VFD_BODY_END: MainForm}
end;
diff --git a/src/corelib/lang_afrikaans.inc b/src/corelib/lang_afrikaans.inc
index 557b361c..3e1941ce 100644
--- a/src/corelib/lang_afrikaans.inc
+++ b/src/corelib/lang_afrikaans.inc
@@ -95,6 +95,11 @@ rsFileGroup = 'Group';
rsSaveAFile = 'Stoor ''n ler';
+// User Dialog
+rsUserName = 'Gebruikers naam';
+rsPassword = 'Wagwoord';
+
+
// Error messages
rsErrListMustBeEmpty = 'Lys moet leeg wees';
rsErrCouldNotOpenDir = 'Could not open the directory <%s>';
diff --git a/src/corelib/lang_english.inc b/src/corelib/lang_english.inc
index d2b3ea77..d3f191c0 100644
--- a/src/corelib/lang_english.inc
+++ b/src/corelib/lang_english.inc
@@ -95,6 +95,11 @@ rsFileGroup = 'Group';
rsSaveAFile = 'Save file as';
+// User Dialog
+rsUserName = 'User name';
+rsPassword = 'Password';
+
+
// Error messages
rsErrListMustBeEmpty = 'List must be empty';
rsErrCouldNotOpenDir = 'Could not open the directory <%s>';
diff --git a/src/corelib/lang_french.inc b/src/corelib/lang_french.inc
index 234c8fc0..0d186126 100644
--- a/src/corelib/lang_french.inc
+++ b/src/corelib/lang_french.inc
@@ -95,6 +95,11 @@ rsFileGroup = 'Groupe';
rsSaveAFile = 'Sauver sous';
+// User Dialog
+rsUserName = 'User name';
+rsPassword = 'Password';
+
+
// Error messages
rsErrListMustBeEmpty = 'Liste doit être vide';
rsErrCouldNotOpenDir = 'Le répertoire <%s> n''a pas pu être ouvert';
diff --git a/src/corelib/lang_german.inc b/src/corelib/lang_german.inc
index e14a5d0e..df5ca54f 100644
--- a/src/corelib/lang_german.inc
+++ b/src/corelib/lang_german.inc
@@ -95,6 +95,11 @@ rsFileGroup = 'Group';
rsSaveAFile = 'Datei speichern';
+// User Dialog
+rsUserName = 'User name';
+rsPassword = 'Password';
+
+
// Error messages
rsErrListMustBeEmpty = 'Liste müssen leer sein';
rsErrCouldNotOpenDir = 'Could not open the directory <%s>';
diff --git a/src/corelib/lang_italian.inc b/src/corelib/lang_italian.inc
index 3fd536a7..e4980ddb 100644
--- a/src/corelib/lang_italian.inc
+++ b/src/corelib/lang_italian.inc
@@ -95,6 +95,10 @@ rsFileGroup = 'Gruppo';
rsSaveAFile = 'Salva con nome';
+// User Dialog
+rsUserName = 'Nome utente';
+rsPassword = 'Password';
+
// Error messages
rsErrListMustBeEmpty = 'Elenco deve essere vuoto';
rsErrCouldNotOpenDir = 'Impossibile aprire la cartella <%s>';
diff --git a/src/corelib/lang_portuguese.inc b/src/corelib/lang_portuguese.inc
index 445ad578..ae6edef5 100644
--- a/src/corelib/lang_portuguese.inc
+++ b/src/corelib/lang_portuguese.inc
@@ -95,6 +95,11 @@ rsFileGroup = 'Group';
rsSaveAFile = 'Salvar arquivo como';
+// User Dialog
+rsUserName = 'User name';
+rsPassword = 'Password';
+
+
// Error messages
rsErrListMustBeEmpty = 'Lista deve estar vazio';
rsErrCouldNotOpenDir = 'Could not open the directory <%s>';
diff --git a/src/corelib/lang_russian.inc b/src/corelib/lang_russian.inc
index fab570ee..1eaaa976 100644
--- a/src/corelib/lang_russian.inc
+++ b/src/corelib/lang_russian.inc
@@ -95,6 +95,11 @@ rsFileGroup = 'Группа';
rsSaveAFile = 'Сохранить файл как';
+// User Dialog
+rsUserName = 'User name';
+rsPassword = 'Password';
+
+
// Error messages
rsErrListMustBeEmpty = 'Список должен быть пустым';
rsErrCouldNotOpenDir = 'Невозможно открыть директорию <%s>';
diff --git a/src/corelib/lang_spanish.inc b/src/corelib/lang_spanish.inc
index 80d1bfe2..492978b8 100644
--- a/src/corelib/lang_spanish.inc
+++ b/src/corelib/lang_spanish.inc
@@ -95,6 +95,11 @@ rsFileGroup = 'Grupo';
rsSaveAFile = 'Guardar como';
+// User Dialog
+rsUserName = 'User name';
+rsPassword = 'Password';
+
+
// Error messages
rsErrListMustBeEmpty = 'La lista debe estar vacia';
rsErrCouldNotOpenDir = 'No se puede abrir la carpeta <%s>';
diff --git a/src/gui/fpgui_package.lpk b/src/gui/fpgui_package.lpk
index cb5391fa..59895323 100644
--- a/src/gui/fpgui_package.lpk
+++ b/src/gui/fpgui_package.lpk
@@ -32,7 +32,7 @@
<License Value="Modified LGPL
"/>
<Version Minor="6" Release="1"/>
- <Files Count="30">
+ <Files Count="31">
<Item1>
<Filename Value="gui_button.pas"/>
<UnitName Value="gui_button"/>
@@ -153,16 +153,20 @@
<Filename Value="messagedialog.inc"/>
<Type Value="Include"/>
</Item30>
+ <Item31>
+ <Filename Value="promptuserdialog.inc"/>
+ <Type Value="Include"/>
+ </Item31>
</Files>
<LazDoc Paths="../../docs/xml/gui/"/>
<RequiredPkgs Count="2">
<Item1>
- <PackageName Value="fpgfx_package"/>
- <MinVersion Minor="6" Release="1" Valid="True"/>
- </Item1>
- <Item2>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
+ </Item1>
+ <Item2>
+ <PackageName Value="fpgfx_package"/>
+ <MinVersion Minor="6" Release="1" Valid="True"/>
</Item2>
</RequiredPkgs>
<UsageOptions>
diff --git a/src/gui/gui_dialogs.pas b/src/gui/gui_dialogs.pas
index fd85d875..660eb1e7 100644
--- a/src/gui/gui_dialogs.pas
+++ b/src/gui/gui_dialogs.pas
@@ -104,7 +104,6 @@ type
public
constructor Create(AOwner: TComponent); override;
end;
-
TfpgFontSelectDialog = class(TfpgBaseDialog)
private
@@ -138,6 +137,8 @@ type
end;
+ { TfpgFileDialog }
+
TfpgFileDialog = class(TfpgBaseDialog)
private
chlDir: TfpgComboBox;
@@ -192,7 +193,7 @@ type
{$I messagedialog.inc}
{$I newdirdialog.inc}
-
+{$I promptuserdialog.inc}
@@ -1309,6 +1310,8 @@ end;
{$I messagedialog.inc}
{$I newdirdialog.inc}
+{$I promptuserdialog.inc}
+
end.
diff --git a/src/gui/messagedialog.inc b/src/gui/messagedialog.inc
index e2c45fb8..c642415f 100644
--- a/src/gui/messagedialog.inc
+++ b/src/gui/messagedialog.inc
@@ -1223,7 +1223,7 @@ var
// try known sets first
if Buttons = mbYesNoCancel then
begin
- { todo: At some stage the StyleManager can give use the correct button
+ { TODO : At some stage the StyleManager can give us the correct button
order based on the OS and Window Manager. }
Result := 3;
sl.Add(cMsgDlgBtnText[mbYes] + '=' + IntToStr(Ord(mbYes)));
@@ -1531,7 +1531,7 @@ begin
begin
Name := 'lblName1';
SetPosition(116, 20, 312, Font.Height);
- Text := 'Label';
+ Text := '';
FontDesc := '#Label2';
end;
diff --git a/src/gui/promptuserdialog.inc b/src/gui/promptuserdialog.inc
new file mode 100644
index 00000000..ccb04a94
--- /dev/null
+++ b/src/gui/promptuserdialog.inc
@@ -0,0 +1,75 @@
+{%mainunit gui_dialogs.pas}
+
+{$IFDEF read_interface}
+
+
+{ 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;
+
+
+{$ENDIF read_interface}
+
+
+
+{$IFDEF read_implementation}
+
+
+{ TfpgPromptUserDialog }
+
+function TfpgPromptUserDialog.GetUserID: TfpgString;
+begin
+ Result := edUserID.Text;
+end;
+
+function TfpgPromptUserDialog.GetUserPassword: TfpgString;
+begin
+ Result := edPassword.Text;
+end;
+
+constructor TfpgPromptUserDialog.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ // reset dimensions
+ Width := 200;
+ Height := 140;
+ MinWidth := 200;
+ MinHeight := 140;
+
+ lblTitle := CreateLabel(self, 8, 8, rsUserName);
+ edUserID := CreateEdit(self, 8, 28, 184, 0);
+ edUserID.Anchors := [anLeft, anTop, anRight];
+
+ lblTitlePw := CreateLabel(self, 8, 55, rsPassword);
+ edPassword := CreateEdit(self, 8, 73, 184, 0);
+ edPassword.Anchors := [anLeft, anTop, anRight];
+ edPassword.PasswordMode := True;
+
+ // 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;
+ btnOK.TabOrder := 3;
+ btnCancel.TabOrder := 4;
+end;
+
+
+{$ENDIF read_implementation}
+