From 108046d42c856be7b9652b62602be27577df9fe6 Mon Sep 17 00:00:00 2001 From: graemeg Date: Fri, 23 May 2008 12:34:23 +0000 Subject: * Just a little bit of code cleanup, nothing more. --- examples/apps/uidesigner/newformdesigner.pas | 8 ++- examples/apps/uidesigner/vfddesigner.pas | 97 +--------------------------- examples/apps/uidesigner/vfdforms.pas | 32 --------- examples/apps/uidesigner/vfdmain.pas | 6 -- 4 files changed, 6 insertions(+), 137 deletions(-) (limited to 'examples') diff --git a/examples/apps/uidesigner/newformdesigner.pas b/examples/apps/uidesigner/newformdesigner.pas index 8a96997c..6cd7e687 100644 --- a/examples/apps/uidesigner/newformdesigner.pas +++ b/examples/apps/uidesigner/newformdesigner.pas @@ -453,13 +453,15 @@ var s: string; i: integer; begin + i := -1; if TwgPaletteButton(Sender).Down then begin s := TwgPaletteButton(Sender).VFDWidget.WidgetClass.ClassName; - chlPalette.FocusItem := chlPalette.Items.IndexOf(s); + i := chlPalette.Items.IndexOf(s); end; - if chlPalette.FocusItem = -1 then - chlPalette.FocusItem := 0; + if i = -1 then + i := 0; // select the '-' item + chlPalette.FocusItem := i; end; { TfrmProperties } diff --git a/examples/apps/uidesigner/vfddesigner.pas b/examples/apps/uidesigner/vfddesigner.pas index 17e1bedc..f8bb23af 100644 --- a/examples/apps/uidesigner/vfddesigner.pas +++ b/examples/apps/uidesigner/vfddesigner.pas @@ -56,7 +56,7 @@ type end; - TFormDesigner = class; + TFormDesigner = class; // forward declaration TDesignedForm = class(TfpgForm) @@ -120,9 +120,7 @@ type procedure DeleteWidgets; procedure EditWidgetOrder; procedure EditTabOrder; -// procedure PutControlByName(x, y: integer; cname: string); procedure InsertWidget(pwg: TfpgWidget; x, y: integer; wgc: TVFDWidgetClass); - procedure OnPaletteChange(Sender: TObject); procedure UpdatePropWin; procedure OnPropTextChange(Sender: TObject); procedure OnPropNameChange(Sender: TObject); @@ -804,99 +802,6 @@ begin MoveResizeWidgets(dx, dy, 0, 0); end; -(* -procedure TFormDesigner.PutControlByName(x, y: integer; cname: string); -var - wg: TfpgWidget; - wgd: TWidgetDesigner; - wgcname: string; - newname: string; - cfrm: TInsertCustomForm; -begin - wgcname := UpperCase(cname); - - Writeln('Putting control: ', wgcname); - - wg := nil; - newname := 'Widget'; - if wgcname = 'LABEL' then - begin - newname := GenerateNewName('lbLabel'); - wg := CreateLabel(FForm, x, y, newname); - end - else if wgcname = 'EDIT' then - begin - newname := GenerateNewName('edEdit'); - wg := CreateEdit(FForm, x, y, 150, 0); - TfpgEdit(wg).Text := newname; - end - else if wgcname = 'BUTTON' then - begin - newname := GenerateNewName('btnButton'); - wg := CreateButton(FForm, x, y, 105, newname, nil); - end - else if wgcname = 'CHECKBOX' then - begin - newname := GenerateNewName('cbCheck'); - wg := CreateCheckBox(FForm, x, y, newname); - end - else if wgcname = 'MEMO' then - begin - newname := GenerateNewName('edMemo'); - wg := TfpgMemo.Create(FForm); - wg.SetPosition(x, y, 120, 80); - TfpgMemo(wg).Text := newname; - end - else if wgcname = 'TEXTLISTBOX' then - begin - newname := GenerateNewName('lstList'); - wg := TfpgListBox.Create(FForm); - wg.SetPosition(x, y, 160, 200); - TfpgListBox(wg).Items.Add(newname); - end - else if wgcname = 'COMBOBOX' then - begin - newname := GenerateNewName('cbComboBox'); - wg := CreateComboBox(FForm, x, y, 150, nil); - TfpgComboBox(wg).Items.Add(newname); - end - else - begin - // custom component - cfrm := TInsertCustomForm.Create(nil); - if cfrm.ShowModal = 1 then - begin - newname := cfrm.edName.Text; - if newname = '' then - newname := GenerateNewName(cfrm.edClass.Text); - wg := TOtherWidget.Create(FForm); - TOtherWidget(wg).wgClassName := cfrm.edClass.Text; - wg.SetPosition(x, y, 200, 24); - end; - cfrm.Free; - - end; - - if wg <> nil then - begin - wg.Name := newname; - wgd := AddWidget(wg, nil); - wg.Visible := True; - DeSelectAll; - wgd.Selected := True; - UpdatePropWin; - end; -end; -*) - -procedure TFormDesigner.OnPaletteChange(Sender: TObject); -begin - if PaletteForm.clist.FocusItem > 0 then - FForm.MouseCursor := mcCross - else - FForm.MouseCursor := mcDefault; -end; - procedure TFormDesigner.UpdatePropWin; var n, i: integer; diff --git a/examples/apps/uidesigner/vfdforms.pas b/examples/apps/uidesigner/vfdforms.pas index 8c19104a..5748dfd7 100644 --- a/examples/apps/uidesigner/vfdforms.pas +++ b/examples/apps/uidesigner/vfdforms.pas @@ -99,14 +99,6 @@ type procedure AfterCreate; override; procedure OnButtonClick(Sender: TObject); end; - - - TPaletteForm = class(TfpgForm) - public - clab: TfpgLabel; - clist: TfpgListBox; - procedure AfterCreate; override; - end; TfrmVFDSetup = class(TfpgForm) @@ -132,8 +124,6 @@ type end; -var - PaletteForm: TPaletteForm; implementation @@ -144,28 +134,6 @@ uses gfx_constants; -{ TPaletteForm } - -procedure TPaletteForm.AfterCreate; -begin - inherited AfterCreate; - WindowPosition := wpUser; - WindowTitle := 'Palette'; - SetPosition(10, 450, 110, 220); - - clab := CreateLabel(self, 3, 3, 'Widget Palette:'); - - clist := TfpgListBox.Create(self); - clist.Left := 1; - clist.Width := Width - 2; - clist.Top := 22; - clist.Height := Height - clist.top - 2; - clist.Anchors := [anLeft, anRight, anTop, anBottom]; - clist.Items.Add('-'); - clist.OnChange := @(maindsgn.OnPaletteChange); -end; - - { TInsertCustomForm } procedure TInsertCustomForm.AfterCreate; diff --git a/examples/apps/uidesigner/vfdmain.pas b/examples/apps/uidesigner/vfdmain.pas index d0e81778..d7d2482b 100644 --- a/examples/apps/uidesigner/vfdmain.pas +++ b/examples/apps/uidesigner/vfdmain.pas @@ -60,7 +60,6 @@ type procedure OnNewFile(Sender: TObject); procedure OnSaveFile(Sender: TObject); procedure OnLoadFile(Sender: TObject); - procedure OnPaletteChange(Sender: TObject); procedure OnPropTextChange(Sender: TObject); procedure OnPropNameChange(Sender: TObject); procedure OnPropPosEdit(Sender: TObject); @@ -265,11 +264,6 @@ begin SelectedForm.OnPropTextChange(Sender); end; -procedure TMainDesigner.OnPaletteChange(Sender: TObject); -begin - -end; - procedure TMainDesigner.OnNewForm(Sender: TObject); var fd: TFormDesigner; -- cgit v1.2.3-70-g09d2