diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-04-07 12:32:59 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-04-07 12:32:59 +0200 |
commit | 2b0bb6d1167e479404bd5d616f4d6155b1a92255 (patch) | |
tree | 364ebdb5572305754a0fb383b08e9240fb946abe /uidesigner | |
parent | 063cf4313bff63e6ec61596e681ac9674b1b7a49 (diff) | |
download | fpGUI-2b0bb6d1167e479404bd5d616f4d6155b1a92255.tar.xz |
ModalResult changed to a enum type
* Replaced all magic number modal results with actual enum values
* UI Designer now uses enum combolist for ModalResult type in
Object Inspector.
* UI Designer now handles default values of ModalResult property correctly.
Diffstat (limited to 'uidesigner')
-rw-r--r-- | uidesigner/newformdesigner.pas | 2 | ||||
-rw-r--r-- | uidesigner/vfddesigner.pas | 8 | ||||
-rw-r--r-- | uidesigner/vfdforms.pas | 6 | ||||
-rw-r--r-- | uidesigner/vfdmain.pas | 5 | ||||
-rw-r--r-- | uidesigner/vfdpropeditgrid.pas | 5 | ||||
-rw-r--r-- | uidesigner/vfdprops.pas | 2 | ||||
-rw-r--r-- | uidesigner/vfdwidgets.pas | 2 |
7 files changed, 13 insertions, 17 deletions
diff --git a/uidesigner/newformdesigner.pas b/uidesigner/newformdesigner.pas index 2e5d00d9..87feed33 100644 --- a/uidesigner/newformdesigner.pas +++ b/uidesigner/newformdesigner.pas @@ -224,7 +224,7 @@ begin FontDesc := '#Label1'; Hint := ''; ImageName := 'stdimg.close'; - ModalResult := 1; + ModalResult := mrOK; TabOrder := 2; end; diff --git a/uidesigner/vfddesigner.pas b/uidesigner/vfddesigner.pas index 9c120686..5405b9bb 100644 --- a/uidesigner/vfddesigner.pas +++ b/uidesigner/vfddesigner.pas @@ -676,7 +676,7 @@ begin if fi <= frm.list.ItemCount then frm.list.FocusItem := fi; - if frm.ShowModal = 1 then + if frm.ShowModal = mrOK then begin for n := 0 to FWidgets.Count - 1 do TWidgetDesigner(FWidgets.Items[n]).Widget.Visible := False; @@ -747,7 +747,7 @@ begin if fi <= frm.list.ItemCount then frm.list.FocusItem := fi; - if frm.ShowModal = 1 then + if frm.ShowModal = mrOK then begin taborder := 1; for n := 0 to frm.List.Items.Count - 1 do @@ -1051,7 +1051,7 @@ begin end; posval := -9999; - if frm.ShowModal = 1 then + if frm.ShowModal = mrOK then posval := StrToIntDef(frm.edPos.Text, -9999); frm.Free; @@ -1422,7 +1422,7 @@ begin //frmie.Top := ay; frmie.edItems.Lines.Assign(sl); - if frmie.ShowModal = 1 then + if frmie.ShowModal = mrOK then begin // Writeln('OK'); sl.Assign(frmie.edItems.Lines); diff --git a/uidesigner/vfdforms.pas b/uidesigner/vfdforms.pas index 00bb3e38..ec60265d 100644 --- a/uidesigner/vfdforms.pas +++ b/uidesigner/vfdforms.pas @@ -364,9 +364,9 @@ var begin if Sender = btnOK then - ModalResult := 1 + ModalResult := mrOK else if Sender = btnCancel then - ModalResult := 2 + ModalResult := mrCancel else begin // up / down @@ -512,7 +512,7 @@ begin FontDesc := '#Label1'; Hint := ''; ImageName := 'stdimg.cancel'; - ModalResult := -1; + ModalResult := mrCancel; TabOrder := 7; end; diff --git a/uidesigner/vfdmain.pas b/uidesigner/vfdmain.pas index 7468a99f..a6b8f0b2 100644 --- a/uidesigner/vfdmain.pas +++ b/uidesigner/vfdmain.pas @@ -24,6 +24,7 @@ interface uses Classes, SysUtils, + fpg_base, fpg_main, fpg_widget, fpg_dialogs, @@ -278,7 +279,7 @@ var nfrm: TNewFormForm; begin nfrm := TNewFormForm.Create(nil); - if nfrm.ShowModal = 1 then + if nfrm.ShowModal = mrOK then if nfrm.edName.Text <> '' then begin fd := TFormDesigner.Create; @@ -412,7 +413,7 @@ var begin frm := TfrmVFDSetup.Create(nil); try - if frm.ShowModal = 1 then + if frm.ShowModal = mrOK then begin LoadDefaults; frmMain.mru.MaxItems := gINI.ReadInteger('Options', 'MRUFileCount', 4); diff --git a/uidesigner/vfdpropeditgrid.pas b/uidesigner/vfdpropeditgrid.pas index bd41f3ee..1a6944cb 100644 --- a/uidesigner/vfdpropeditgrid.pas +++ b/uidesigner/vfdpropeditgrid.pas @@ -227,7 +227,6 @@ begin Text := 'New'; FontDesc := '#Label1'; ImageName := ''; - ModalResult := 0; OnClick := @NewButtonClick; end; @@ -239,7 +238,6 @@ begin Text := 'Delete'; FontDesc := '#Label1'; ImageName := ''; - ModalResult := 0; OnClick := @DeleteButtonClick; end; @@ -251,7 +249,6 @@ begin Text := 'UP'; FontDesc := '#Label1'; ImageName := ''; - ModalResult := 0; OnClick := @UpDownButtonClick; end; @@ -263,7 +260,6 @@ begin Text := 'DOWN'; FontDesc := '#Label1'; ImageName := ''; - ModalResult := 0; OnClick := @UpDownButtonClick; end; @@ -275,7 +271,6 @@ begin Text := 'Close'; FontDesc := '#Label1'; ImageName := 'stdimg.close'; - ModalResult := 0; OnClick := @CloseButtonClick; end; diff --git a/uidesigner/vfdprops.pas b/uidesigner/vfdprops.pas index 0332a47d..99e932a5 100644 --- a/uidesigner/vfdprops.pas +++ b/uidesigner/vfdprops.pas @@ -173,7 +173,7 @@ begin frm := TItemEditorForm.Create(nil); try frm.edItems.Lines.Assign(sl); - if frm.ShowModal = 1 then + if frm.ShowModal = mrOK then sl.Assign(frm.edItems.Lines); finally frm.Free; diff --git a/uidesigner/vfdwidgets.pas b/uidesigner/vfdwidgets.pas index 597a6a30..112462f4 100644 --- a/uidesigner/vfdwidgets.pas +++ b/uidesigner/vfdwidgets.pas @@ -360,7 +360,7 @@ begin wc.AddProperty('ImageMargin', TPropertyInteger, 'Space between image and border, -1 centers image/text'); wc.AddProperty('ImageName', TPropertyString, ''); wc.AddProperty('ImageSpacing', TPropertyInteger, 'Space between image and text, -1 centers text'); - wc.AddProperty('ModalResult', TPropertyInteger, ''); + wc.AddProperty('ModalResult', TPropertyEnum, 'Modal Result returned and overrides the OnClick event handler'); wc.AddProperty('ParentShowHint', TPropertyBoolean, ''); wc.AddProperty('ShowHint', TPropertyBoolean, ''); wc.AddProperty('ShowImage', TPropertyBoolean, 'Boolean value'); |