diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2013-03-13 17:07:32 +0000 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2013-03-13 17:07:32 +0000 |
commit | 2294374b3cc195e8803cbed93e94071074c12e22 (patch) | |
tree | 0aa0cb2834a1039407866bb012d81be01c69c2c8 /examples | |
parent | 9f5d24cf0ddc0af21442944c987b53a893e0d649 (diff) | |
download | fpGUI-2294374b3cc195e8803cbed93e94071074c12e22.tar.xz |
nanoedit: Implements a statusbar to show current file name being edited
Diffstat (limited to 'examples')
-rw-r--r-- | examples/apps/nanoedit/mainfrm.pas | 40 | ||||
-rw-r--r-- | examples/apps/nanoedit/nanoedit.lpi | 2 |
2 files changed, 38 insertions, 4 deletions
diff --git a/examples/apps/nanoedit/mainfrm.pas b/examples/apps/nanoedit/mainfrm.pas index 6de386ce..5cece909 100644 --- a/examples/apps/nanoedit/mainfrm.pas +++ b/examples/apps/nanoedit/mainfrm.pas @@ -6,7 +6,8 @@ interface uses SysUtils, Classes, fpg_base, fpg_main, - fpg_form, fpg_button, fpg_menu, fpg_textedit; + fpg_form, fpg_button, fpg_menu, fpg_textedit, fpg_panel, + fpg_label; type @@ -15,14 +16,17 @@ type {@VFD_HEAD_BEGIN: MainFrom} menu: TfpgMenuBar; mnuFile: TfpgPopupMenu; + mnuEdit: TfpgPopupMenu; mnuSearch: TfpgPopupMenu; memEditor: TfpgTextEdit; btnGO: TfpgButton; - mnuEdit: TfpgPopupMenu; + bevStatusBar: TfpgBevel; + lblStatusText: TfpgLabel; {@VFD_HEAD_END: MainFrom} FTextToFind: TfpgString; FFindOptions: TfpgFindOptions; FIsForward: boolean; + FFilename: TfpgString; procedure FormShow(Sender: TObject); procedure miOpenClick(Sender: TObject); procedure miSaveClick(Sender: TObject); @@ -62,6 +66,8 @@ begin if Pos('file://', s) > 0 then s := StringReplace(s, 'file://', '', []); memEditor.LoadFromFile(s); + FFilename := s; + lblStatusText.Text := FFilename; end; end; @@ -74,6 +80,7 @@ begin if dlg.RunOpenFile then begin memEditor.Lines.LoadFromFile(dlg.FileName); + FFileName := dlg.FileName; end; finally dlg.Free; @@ -86,6 +93,8 @@ var begin dlg := TfpgFileDialog.Create(nil); try + if FFilename <> '' then + dlg.FileName := FFilename; if dlg.RunSaveFile then begin memEditor.Lines.SaveToFile(dlg.FileName); @@ -101,9 +110,13 @@ var begin dlg := TfpgFileDialog.Create(nil); try + if FFilename <> '' then + dlg.FileName := FFilename; if dlg.RunSaveFile then begin memEditor.Lines.SaveToFile(dlg.FileName); + FFilename := dlg.FileName; + lblStatusText.Text := FFilename; end; finally dlg.Free; @@ -266,7 +279,7 @@ begin with memEditor do begin Name := 'memEditor'; - SetPosition(0, 52, 717, 358); + SetPosition(0, 52, 717, 332); Anchors := [anLeft,anRight,anTop,anBottom]; FontDesc := '#edit2'; GutterVisible := True; @@ -286,6 +299,27 @@ begin OnClick := @btnGOClick; end; + bevStatusBar := TfpgBevel.Create(self); + with bevStatusBar do + begin + Name := 'bevStatusBar'; + SetPosition(1, 387, 715, 22); + Anchors := [anLeft,anRight,anBottom]; + Hint := ''; + Style := bsLowered; + end; + + lblStatusText := TfpgLabel.Create(bevStatusBar); + with lblStatusText do + begin + Name := 'lblStatusText'; + SetPosition(4, 4, 704, 15); + Anchors := [anLeft,anRight,anTop]; + FontDesc := '#Label1'; + Hint := ''; + Text := ''; + end; + {@VFD_BODY_END: MainFrom} menu.AddMenuItem('&File', nil).SubMenu := mnuFile; diff --git a/examples/apps/nanoedit/nanoedit.lpi b/examples/apps/nanoedit/nanoedit.lpi index 8a70af1f..7211172c 100644 --- a/examples/apps/nanoedit/nanoedit.lpi +++ b/examples/apps/nanoedit/nanoedit.lpi @@ -63,7 +63,7 @@ </Units> </ProjectOptions> <CompilerOptions> - <Version Value="9"/> + <Version Value="11"/> <Target> <Filename Value="nanoedit"/> </Target> |