diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-03-26 07:35:51 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-03-26 07:35:51 +0000 |
commit | 2d038b8826cc04b9616f1666797b3550b4ebe489 (patch) | |
tree | 57e5749bea41daece04e33b6ea1f99d36ef64e4e /examples | |
parent | 85aa1c94def86c59eef15c44e7240e352c0267fa (diff) | |
download | fpGUI-2d038b8826cc04b9616f1666797b3550b4ebe489.tar.xz |
* Applied patch from Vladimir improving the Save support and file handling with OS Encoding for UI Designer.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/apps/uidesigner/newformdesigner.pas | 14 | ||||
-rw-r--r-- | examples/apps/uidesigner/vfdfile.pas | 5 | ||||
-rw-r--r-- | examples/apps/uidesigner/vfdmain.pas | 35 |
3 files changed, 33 insertions, 21 deletions
diff --git a/examples/apps/uidesigner/newformdesigner.pas b/examples/apps/uidesigner/newformdesigner.pas index 429556fc..e666c68c 100644 --- a/examples/apps/uidesigner/newformdesigner.pas +++ b/examples/apps/uidesigner/newformdesigner.pas @@ -35,6 +35,7 @@ uses gui_combobox, gui_menu, gui_mru, + gui_hyperlink, vfdwidgetclass, vfdwidgets; @@ -151,7 +152,7 @@ type lblVersion: TfpgLabel; btnName1: TfpgButton; lblName3: TfpgLabel; - lblName4: TfpgLabel; + lblName4: TfpgHyperlink; lblCompiled: TfpgLabel; {@VFD_HEAD_END: frmAbout} procedure AfterCreate; override; @@ -229,13 +230,16 @@ begin FontDesc := 'Arial-9'; end; - lblName4 := TfpgLabel.Create(self); + lblName4 := TfpgHyperlink.Create(self); with lblName4 do begin Name := 'lblName4'; SetPosition(12, 116, 246, 14); Text := 'http://opensoft.homeip.net/fpgui/'; + URL := 'http://opensoft.homeip.net/fpgui/'; FontDesc := 'Arial-9:underline'; + HotTrackColor := clRoyalBlue; + HotTrackFont := 'Arial-9:underline'; end; lblCompiled := TfpgLabel.Create(self); @@ -352,8 +356,7 @@ begin AddMenuItem('New', '', @(maindsgn.OnNewFile)); AddMenuItem('Open', '', @(maindsgn.OnLoadFile)); FFileOpenRecent := AddMenuItem('Open Recent...', '', nil); - // FFileOpenRecent.Enabled := False; - AddMenuItem('Save', '', @(maindsgn.OnSaveFile)); + AddMenuItem('Save As...', '', @(maindsgn.OnSaveFile)); AddMenuItem('-', '', nil); AddMenuItem('New Form...', '', @(maindsgn.OnNewForm)); AddMenuItem('-', '', nil); @@ -366,8 +369,9 @@ begin Name := 'formmenu'; SetPosition(464, 48, 120, 20); AddMenuItem('Widget Order...', '', @(maindsgn.OnEditWidgetOrder)); + AddMenuItem('Tab Order...', '', nil).Enabled := False; // TODO AddMenuItem('-', '', nil); - AddMenuItem('Edit special...', '', nil).Enabled := False; + AddMenuItem('Edit special...', '', nil).Enabled := False; // TODO end; setmenu := TfpgPopupMenu.Create(self); diff --git a/examples/apps/uidesigner/vfdfile.pas b/examples/apps/uidesigner/vfdfile.pas index 7872bbcd..f01fbf4f 100644 --- a/examples/apps/uidesigner/vfdfile.pas +++ b/examples/apps/uidesigner/vfdfile.pas @@ -24,7 +24,8 @@ interface uses SysUtils, - Classes; + Classes, + gfx_utils; type TVFDFileBlock = class @@ -265,7 +266,7 @@ var cnt: integer; begin Result := False; - AssignFile(ff, fname); + AssignFile(ff, fpgToOSEncoding(fname)); try Reset(ff, 1); except diff --git a/examples/apps/uidesigner/vfdmain.pas b/examples/apps/uidesigner/vfdmain.pas index afdab0fe..f78b0787 100644 --- a/examples/apps/uidesigner/vfdmain.pas +++ b/examples/apps/uidesigner/vfdmain.pas @@ -137,7 +137,7 @@ begin end; FDesigners.Clear; - if not FileExists(fname) then + if not fpgFileExists(fname) then begin ShowMessage('File does not exists.', 'Error loading form'); Exit; @@ -174,18 +174,24 @@ var begin fname := EditedFileName; - afiledialog := TfpgFileDialog.Create(nil); - afiledialog.Filename := EditedFilename; - afiledialog.WindowTitle := 'Save form source'; - afiledialog.Filter := 'Pascal source files (*.pas;*.inc;*.dpr;*.lpr)|*.pas;*.inc;*.dpr;*.lpr|All Files (*)|*'; - if afiledialog.RunSaveFile then - begin - EditedFileName := aFileDialog.Filename; - fname := EditedFilename; - end + if ((Sender as TComponent).Name = 'btnSave') + and (EditedFileName <> '') then + fname := EditedFileName else - fname := ''; - aFileDialog.Free; + begin + afiledialog := TfpgFileDialog.Create(nil); + afiledialog.Filename := EditedFilename; + afiledialog.WindowTitle := 'Save form source'; + afiledialog.Filter := 'Pascal source files (*.pas;*.inc;*.dpr;*.lpr)|*.pas;*.inc;*.dpr;*.lpr|All Files (*)|*'; + if afiledialog.RunSaveFile then + begin + EditedFileName := aFileDialog.Filename; + fname := EditedFilename; + end + else + fname := ''; + aFileDialog.Free; + end; if fname = '' then Exit; @@ -214,7 +220,7 @@ begin fdata := FFile.MergeBlocks; - AssignFile(ff, fname); + AssignFile(ff, fpgToOSEncoding(fname)); try Rewrite(ff, 1); try @@ -222,7 +228,8 @@ begin finally CloseFile(ff); end; - frmMain.WindowTitle := 'fpGUI Designer v' + program_version + ' - ' + fname; + // frmMain.WindowTitle := 'fpGUI Designer v' + program_version + ' - ' + fname; + // everything is done by SetEditedFileName (EditedFileName := ...) frmMain.mru.AddItem(fname); except Writeln('Form save I/O failure.'); |