diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-08-30 21:27:05 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-08-30 21:27:05 +0200 |
commit | 0600fac36896ef3a50f8cb2b8d1384cbf1bb987c (patch) | |
tree | b5bb7ed660cb299fb0344121c211fb4d9fdc6b81 /examples | |
parent | 3dc81c0f2407c4936c48befacbc6dfab57bf1aa0 (diff) | |
download | fpGUI-0600fac36896ef3a50f8cb2b8d1384cbf1bb987c.tar.xz |
ide: created a basic Find dialog.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/apps/ide/src/frm_find.pas | 218 |
1 files changed, 218 insertions, 0 deletions
diff --git a/examples/apps/ide/src/frm_find.pas b/examples/apps/ide/src/frm_find.pas new file mode 100644 index 00000000..54a03237 --- /dev/null +++ b/examples/apps/ide/src/frm_find.pas @@ -0,0 +1,218 @@ +unit frm_find; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, Classes, + fpg_base, + fpg_main, + fpg_form, + fpg_label, + fpg_edit, + fpg_button, + fpg_checkbox; + +type + + TFindForm = class(TfpgForm) + private + {@VFD_HEAD_BEGIN: FindForm} + Label1: TfpgLabel; + edtFindText: TfpgEdit; + chkReplace: TfpgCheckBox; + edtReplaceText: TfpgEdit; + Label2: TfpgLabel; + chkCaseSensitive: TfpgCheckBox; + chkWholeWord: TfpgCheckBox; + CheckBox3: TfpgCheckBox; + CheckBox4: TfpgCheckBox; + btnCancel: TfpgButton; + btnFind: TfpgButton; + btnHelp: TfpgButton; + {@VFD_HEAD_END: FindForm} + public + procedure AfterCreate; override; + end; + +procedure DisplayFindForm(var AFindText: TfpgString); + +{@VFD_NEWFORM_DECL} + +implementation + +procedure DisplayFindForm(var AFindText: TfpgString); +var + frm: TFindForm; +begin + frm := TFindForm.Create(nil); + try + if frm.ShowModal = mrCancel then + AFindText := '' + else + AFindText := frm.edtFindText.Text; + finally + frm.Free; + end; +end; + +{@VFD_NEWFORM_IMPL} + +procedure TFindForm.AfterCreate; +begin + {%region 'Auto-generated GUI code' -fold} + {@VFD_BODY_BEGIN: FindForm} + Name := 'FindForm'; + SetPosition(458, 214, 300, 250); + WindowTitle := 'Find'; + Hint := ''; + + Label1 := TfpgLabel.Create(self); + with Label1 do + begin + Name := 'Label1'; + SetPosition(4, 4, 284, 20); + FontDesc := '#Label1'; + Hint := ''; + Text := 'Text to find:'; + end; + + edtFindText := TfpgEdit.Create(self); + with edtFindText do + begin + Name := 'edtFindText'; + SetPosition(4, 22, 292, 24); + Anchors := [anLeft,anRight,anTop]; + ExtraHint := ''; + FontDesc := '#Edit1'; + Hint := ''; + TabOrder := 2; + Text := ''; + end; + + chkReplace := TfpgCheckBox.Create(self); + with chkReplace do + begin + Name := 'chkReplace'; + SetPosition(4, 50, 188, 20); + FontDesc := '#Label1'; + Hint := ''; + TabOrder := 3; + Text := 'Replace with'; + end; + + edtReplaceText := TfpgEdit.Create(self); + with edtReplaceText do + begin + Name := 'edtReplaceText'; + SetPosition(4, 70, 292, 24); + Anchors := [anLeft,anRight,anTop]; + ExtraHint := ''; + FontDesc := '#Edit1'; + Hint := ''; + TabOrder := 4; + Text := ''; + end; + + Label2 := TfpgLabel.Create(self); + with Label2 do + begin + Name := 'Label2'; + SetPosition(4, 100, 160, 16); + FontDesc := '#Label2'; + Hint := ''; + Text := 'Options'; + end; + + chkCaseSensitive := TfpgCheckBox.Create(self); + with chkCaseSensitive do + begin + Name := 'chkCaseSensitive'; + SetPosition(16, 120, 160, 20); + FontDesc := '#Label1'; + Hint := ''; + TabOrder := 6; + Text := 'Case Sensitive'; + end; + + chkWholeWord := TfpgCheckBox.Create(self); + with chkWholeWord do + begin + Name := 'chkWholeWord'; + SetPosition(16, 140, 160, 20); + FontDesc := '#Label1'; + Hint := ''; + TabOrder := 7; + Text := 'Whole Words Only'; + end; + + CheckBox3 := TfpgCheckBox.Create(self); + with CheckBox3 do + begin + Name := 'CheckBox3'; + SetPosition(16, 160, 160, 20); + FontDesc := '#Label1'; + Hint := ''; + TabOrder := 8; + Text := 'CheckBox'; + end; + + CheckBox4 := TfpgCheckBox.Create(self); + with CheckBox4 do + begin + Name := 'CheckBox4'; + SetPosition(16, 180, 160, 20); + FontDesc := '#Label1'; + Hint := ''; + TabOrder := 9; + Text := 'CheckBox'; + end; + + btnCancel := TfpgButton.Create(self); + with btnCancel do + begin + Name := 'btnCancel'; + SetPosition(216, 220, 80, 24); + Anchors := [anRight,anBottom]; + Text := 'Cancel'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 10; + ModalResult := mrCancel; + end; + + btnFind := TfpgButton.Create(self); + with btnFind do + begin + Name := 'btnFind'; + SetPosition(132, 220, 80, 24); + Anchors := [anRight,anBottom]; + Text := 'Find'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 11; + ModalResult := mrOK; + end; + + btnHelp := TfpgButton.Create(self); + with btnHelp do + begin + Name := 'btnHelp'; + SetPosition(4, 220, 24, 24); + Anchors := [anLeft,anBottom]; + Text := '?'; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 12; + end; + + {@VFD_BODY_END: FindForm} + {%endregion} +end; + + +end. |