diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2010-05-23 23:18:57 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2010-05-23 23:18:57 +0200 |
commit | 6e214f72923e2f10d0f8af78af1e278305e3e814 (patch) | |
tree | 3ec1f95b651099600a3214d3c1a54212caeb3633 | |
parent | c5ab0bf73a02edcbdda25b30ff98780893238d21 (diff) | |
download | fpGUI-6e214f72923e2f10d0f8af78af1e278305e3e814.tar.xz |
New Input Query (text) Dialog and global function fpgInputQuery().
-rw-r--r-- | src/corelib/gdi/fpgui_toolkit.lpk | 8 | ||||
-rw-r--r-- | src/corelib/x11/fpgui_toolkit.lpk | 6 | ||||
-rw-r--r-- | src/gui/fpg_dialogs.pas | 3 | ||||
-rw-r--r-- | src/gui/inputquerydialog.inc | 134 | ||||
-rw-r--r-- | src/gui/selectdirdialog.inc | 3 |
5 files changed, 148 insertions, 6 deletions
diff --git a/src/corelib/gdi/fpgui_toolkit.lpk b/src/corelib/gdi/fpgui_toolkit.lpk index a269e705..127b315f 100644 --- a/src/corelib/gdi/fpgui_toolkit.lpk +++ b/src/corelib/gdi/fpgui_toolkit.lpk @@ -31,7 +31,7 @@ <Description Value="fpGUI Toolkit"/>
<License Value="LGPL 2 with static linking exception."/>
<Version Minor="7"/>
- <Files Count="77">
+ <Files Count="78">
<Item1>
<Filename Value="..\stdimages.inc"/>
<Type Value="Include"/>
@@ -340,6 +340,10 @@ <Filename Value="..\fpg_imgfmt_jpg.pas"/>
<UnitName Value="fpg_imgfmt_jpg"/>
</Item77>
+ <Item78>
+ <Filename Value="..\..\gui\inputquerydialog.inc"/>
+ <Type Value="Include"/>
+ </Item78>
</Files>
<LazDoc Paths="..\..\..\docs\xml\corelib\;..\..\..\docs\xml\corelib\x11\;..\..\..\docs\xml\corelib\gdi\;..\..\..\docs\xml\gui\"/>
<RequiredPkgs Count="1">
@@ -356,4 +360,4 @@ <IgnoreBinaries Value="False"/>
</PublishOptions>
</Package>
-</CONFIG>
+</CONFIG>
\ No newline at end of file diff --git a/src/corelib/x11/fpgui_toolkit.lpk b/src/corelib/x11/fpgui_toolkit.lpk index 43de2bc7..1e2bd934 100644 --- a/src/corelib/x11/fpgui_toolkit.lpk +++ b/src/corelib/x11/fpgui_toolkit.lpk @@ -32,7 +32,7 @@ <License Value="LGPL 2 with static linking exception. "/> <Version Minor="7"/> - <Files Count="81"> + <Files Count="82"> <Item1> <Filename Value="../stdimages.inc"/> <Type Value="Include"/> @@ -357,6 +357,10 @@ <Filename Value="../fpg_imgfmt_jpg.pas"/> <UnitName Value="fpg_imgfmt_jpg"/> </Item81> + <Item82> + <Filename Value="../../gui/inputquerydialog.inc"/> + <Type Value="Include"/> + </Item82> </Files> <LazDoc Paths="../../../docs/xml/corelib/;../../../docs/xml/corelib/x11/;../../../docs/xml/corelib/gdi/;../../../docs/xml/gui/"/> <RequiredPkgs Count="1"> diff --git a/src/gui/fpg_dialogs.pas b/src/gui/fpg_dialogs.pas index 66a4e89c..73c668c3 100644 --- a/src/gui/fpg_dialogs.pas +++ b/src/gui/fpg_dialogs.pas @@ -209,6 +209,7 @@ type {$I selectdirdialog.inc} {$I charmapdialog.inc} {$I colordialog.inc} +{$I inputquerydialog.inc} @@ -220,6 +221,7 @@ function SelectFileDialog(const ADialogType: boolean = sfdOpen; const AFilter: T function SelectDirDialog(const AStartDir: TfpgString = ''): TfpgString; function fpgShowCharMap: TfpgString; function fpgSelectColorDialog(APresetColor: TfpgColor = clBlack): TfpgColor; +function fpgInputQuery(const ACaption, APrompt: TfpgString; var Value: TfpgString): Boolean; implementation @@ -1433,6 +1435,7 @@ end; {$I selectdirdialog.inc} {$I charmapdialog.inc} {$I colordialog.inc} +{$I inputquerydialog.inc} end. diff --git a/src/gui/inputquerydialog.inc b/src/gui/inputquerydialog.inc new file mode 100644 index 00000000..5b063233 --- /dev/null +++ b/src/gui/inputquerydialog.inc @@ -0,0 +1,134 @@ +{ + fpGUI - Free Pascal GUI Toolkit + + Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + distribution, for details of the copyright. + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + This unit contains the Input Query dialogs. +} + +{%mainunit fpg_dialogs.pas} + +{$IFDEF read_interface} + +type + + TfpgQueryDialog = class(TfpgForm) + private + {@VFD_HEAD_BEGIN: fpgQueryDialog} + lblText: TfpgLabel; + edtText: TfpgEdit; + btnOK: TfpgButton; + btnCancel: TfpgButton; + {@VFD_HEAD_END: fpgQueryDialog} + procedure SetupCaptions; + public + procedure AfterCreate; override; + end; + + +{$ENDIF read_interface} + +{$IFDEF read_implementation} + +function fpgInputQuery(const ACaption, APrompt: TfpgString; var Value: TfpgString): Boolean; +var + dlg: TfpgQueryDialog; +begin + dlg := TfpgQueryDialog.Create(nil); + try + dlg.WindowTitle := ACaption; + dlg.lblText.Text := APrompt; + Result := dlg.ShowModal = mrOK; + Value := dlg.edtText.Text; + finally + dlg.Free; + end; +end; + +{ TfpgQueryDialog } + +procedure TfpgQueryDialog.SetupCaptions; +begin + btnOK.Text := rsOK; + btnCancel.Text := rsCancel; +end; + +procedure TfpgQueryDialog.AfterCreate; +begin + {%region 'Auto-generated GUI code' -fold} + {@VFD_BODY_BEGIN: fpgQueryDialog} + Name := 'fpgQueryDialog'; + SetPosition(300, 150, 340, 97); + WindowTitle := 'QueryDialog'; + Hint := ''; + WindowPosition := wpOneThirdDown; + + lblText := TfpgLabel.Create(self); + with lblText do + begin + Name := 'lblText'; + SetPosition(8, 8, 324, 16); + Anchors := [anLeft,anRight,anTop]; + FontDesc := '#Label1'; + Hint := ''; + Text := 'lblText'; + end; + + edtText := TfpgEdit.Create(self); + with edtText do + begin + Name := 'edtText'; + SetPosition(8, 26, 324, 24); + Anchors := [anLeft,anRight,anTop]; + ExtraHint := ''; + Hint := ''; + TabOrder := 2; + Text := ''; + FontDesc := '#Edit1'; + end; + + btnOK := TfpgButton.Create(self); + with btnOK do + begin + Name := 'btnOK'; + SetPosition(144, 64, 92, 24); + Anchors := [anRight,anBottom]; + Text := 'OK'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + ModalResult := mrOK; + TabOrder := 3; + end; + + btnCancel := TfpgButton.Create(self); + with btnCancel do + begin + Name := 'btnCancel'; + SetPosition(240, 64, 92, 24); + Anchors := [anRight,anBottom]; + Text := 'Cancel'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + ModalResult := mrCancel; + TabOrder := 4; + end; + + {@VFD_BODY_END: fpgQueryDialog} + {%endregion} + + SetupCaptions; +end; + +{$ENDIF read_implementation} + diff --git a/src/gui/selectdirdialog.inc b/src/gui/selectdirdialog.inc index b9da189b..d09f11c8 100644 --- a/src/gui/selectdirdialog.inc +++ b/src/gui/selectdirdialog.inc @@ -2,9 +2,6 @@ {$IFDEF read_interface} - - { TfpgSelectDirDialog } - TfpgSelectDirDialog = class(TfpgBaseDialog) private tv: TfpgTreeView; |