diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-09-08 16:12:43 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-09-08 16:12:43 +0000 |
commit | 54ce3cfb4e1d9295f7b2a14e1e3be0480b0ce7ee (patch) | |
tree | 6f55e17e8d5e8053b50de847260913802028de01 | |
parent | 26cb129aeae6c69b9d5ca670c0ecee67429f0861 (diff) | |
download | fpGUI-54ce3cfb4e1d9295f7b2a14e1e3be0480b0ce7ee.tar.xz |
* Made a few modifications so the GUI Designer works under Windows.
-rw-r--r-- | examples/apps/uidesigner/aanewform.pas | 156 | ||||
-rw-r--r-- | examples/apps/uidesigner/uidesigner.lpi | 7 | ||||
-rw-r--r-- | examples/apps/uidesigner/vfdprops.pas | 3 | ||||
-rw-r--r-- | examples/apps/uidesigner/vfdresizer.pas | 1 | ||||
-rw-r--r-- | src/corelib/gfx_widget.pas | 14 | ||||
-rw-r--r-- | src/gui/gui_basegrid.pas | 2 | ||||
-rw-r--r-- | src/gui/gui_memo.pas | 3 | ||||
-rw-r--r-- | src/gui/gui_tree.pas | 2 |
8 files changed, 105 insertions, 83 deletions
diff --git a/examples/apps/uidesigner/aanewform.pas b/examples/apps/uidesigner/aanewform.pas index 688a1cd1..34ecfb25 100644 --- a/examples/apps/uidesigner/aanewform.pas +++ b/examples/apps/uidesigner/aanewform.pas @@ -14,21 +14,21 @@ uses type - TfrmValami = class(TGfxForm) + TfrmValami = class(TfpgForm) public {@VFD_HEAD_BEGIN: frmValami} - ed1 : TwgEdit; - btn1 : TwgButton; - chl1 : TwgChoiceList; - wg1 : Twg; - lst1 : TwgTextListBox; - memo1 : TwgMemo; - grid1 : TwgDBGrid; - panel1 : TwgBevel; - lb1 : TwgLabel; - ed2 : TwgEdit; - panel2 : TwgBevel; - lb2 : TwgLabel; + ed1 : TfpgEdit; + btn1 : TfpgButton; + chl1 : TfpgComboBox; + wg1 : Tfpg; + lst1 : TfpgListBox; + memo1 : TfpgMemo; + grid1 : TfpgStringGrid; + panel1 : TfpgBevel; + lb1 : TfpgLabel; + ed2 : TfpgEdit; + panel2 : TfpgBevel; + lb2 : TfpgLabel; {@VFD_HEAD_END: frmValami} procedure AfterCreate; override; @@ -37,11 +37,11 @@ type TfrmVFDSetup = class(TGfxForm) public {@VFD_HEAD_BEGIN: frmVFDSetup} - panel1 : TwgBevel; - lb1 : TwgLabel; - chl1 : TwgChoiceList; - btnOK : TwgButton; - btnCancel : TwgButton; + panel1 : TfpgBevel; + lb1 : TfpgLabel; + chl1 : TfpgComboBox; + btnOK : TfpgButton; + btnCancel : TfpgButton; {@VFD_HEAD_END: frmVFDSetup} procedure AfterCreate; override; @@ -56,51 +56,51 @@ implementation procedure TfrmVFDSetup.AfterCreate; begin {@VFD_BODY_BEGIN: frmVFDSetup} - SetDimensions(331,481,237,103); - WindowTitle8 := 'General settings'; + SetPosition(331,481,237,103); + WindowTitle := 'General settings'; - panel1 := TwgBevel.Create(self); + panel1 := TfpgBevel.Create(self); with panel1 do begin - SetDimensions(8,12,220,52); + SetPosition(8,12,220,52); shape := bsBox; style := bsRaised; end; - lb1 := TwgLabel.Create(panel1); + lb1 := TfpgLabel.Create(panel1); with lb1 do begin - SetDimensions(8,16,92,16); - Text := u8('Grid resolution:'); + SetPosition(8,16,92,16); + Text := 'Grid resolution:'; FontName := '#Label1'; end; - chl1 := TwgChoiceList.Create(panel1); + chl1 := TfpgComboBox.Create(panel1); with chl1 do begin - SetDimensions(116,14,56,22); - Items.Add(u8('1')); - Items.Add(u8('4')); - Items.Add(u8('5')); + SetPosition(116,14,56,22); + Items.Add('1'); + Items.Add('4'); + Items.Add('5'); FontName := '#List'; FocusItem := 2; end; - btnOK := TwgButton.Create(self); + btnOK := TfpgButton.Create(self); with btnOK do begin - SetDimensions(8,72,96,24); - Text := u8('OK'); + SetPosition(8,72,96,24); + Text := 'OK'; FontName := '#Label1'; ImageName := 'stdimg.ok'; ModalResult := 1; end; - btnCancel := TwgButton.Create(self); + btnCancel := TfpgButton.Create(self); with btnCancel do begin - SetDimensions(132,72,96,24); - Text := u8('Cancel'); + SetPosition(132,72,96,24); + Text := 'Cancel'; FontName := '#Label1'; ImageName := 'stdimg.cancel'; ModalResult := -1; @@ -113,110 +113,110 @@ end; procedure TfrmValami.AfterCreate; begin {@VFD_BODY_BEGIN: frmValami} - SetDimensions(310,122,491,340); - WindowTitle8 := 'frmValami'; + SetPosition(310,122,491,340); + WindowTitle := 'frmValami'; - ed1 := TwgEdit.Create(self); + ed1 := TfpgEdit.Create(self); with ed1 do begin - SetDimensions(12,48,120,22); - Text := u8(''); + SetPosition(12,48,120,22); + Text := ''; FontName := '#Edit1'; end; - btn1 := TwgButton.Create(self); + btn1 := TfpgButton.Create(self); with btn1 do begin - SetDimensions(12,76,96,24); - Text := u8('Button'); + SetPosition(12,76,96,24); + Text := 'Button'; FontName := '#Label1'; ImageName := 'stdimg.ok'; ModalResult := 0; end; - chl1 := TwgChoiceList.Create(self); + chl1 := TfpgComboBox.Create(self); with chl1 do begin - SetDimensions(148,40,120,22); - Items.Add(u8('egy')); - Items.Add(u8('ketto')); - Items.Add(u8('harom')); + SetPosition(148,40,120,22); + Items.Add('egy'); + Items.Add('ketto'); + Items.Add('harom'); FontName := '#List'; end; - wg1 := Twg.Create(self); + wg1 := Tfpg.Create(self); with wg1 do begin - SetDimensions(148,84,120,32); + SetPosition(148,84,120,32); end; - lst1 := TwgTextListBox.Create(self); + lst1 := TfpgListBox.Create(self); with lst1 do begin - SetDimensions(12,116,104,92); - Items.Add(u8('as')); - Items.Add(u8('asdf')); - Items.Add(u8('asd')); - Items.Add(u8('f as')); + SetPosition(12,116,104,92); + Items.Add('as')); + Items.Add('asdf'); + Items.Add('asd'); + Items.Add('f as'); FontName := '#List'; end; - memo1 := TwgMemo.Create(self); + memo1 := TfpgMemo.Create(self); with memo1 do begin - SetDimensions(136,124,120,72); - Lines.Add(u8('valami szoveg')); - Lines.Add(u8('masodik sor')); + SetPosition(136,124,120,72); + Lines.Add('valami szoveg'); + Lines.Add('masodik sor'); FontName := '#Edit1'; end; - grid1 := TwgDBGrid.Create(self); + grid1 := TfpgStringGrid.Create(self); with grid1 do begin - SetDimensions(16,216,180,104); - AddColumn8('ID','',50,alLeft); - AddColumn8('NAME','',70,alLeft); + SetPosition(16,216,180,104); + AddColumn('ID','',50,alLeft); + AddColumn('NAME','',70,alLeft); FontName := '#Grid'; HeaderFontName := '#GridHeader'; end; - panel1 := TwgBevel.Create(self); + panel1 := TfpgBevel.Create(self); with panel1 do begin - SetDimensions(276,156,192,148); + SetPosition(276,156,192,148); shape := bsBox; style := bsRaised; end; - lb1 := TwgLabel.Create(panel1); + lb1 := TfpgLabel.Create(panel1); with lb1 do begin - SetDimensions(16,8,80,16); - Text := u8('Label'); + SetPosition(16,8,80,16); + Text := 'Label'; FontName := '#Label1'; end; - ed2 := TwgEdit.Create(panel1); + ed2 := TfpgEdit.Create(panel1); with ed2 do begin - SetDimensions(8,32,120,22); - Text := u8(''); + SetPosition(8,32,120,22); + Text := ''; FontName := '#Edit1'; end; - panel2 := TwgBevel.Create(panel1); + panel2 := TfpgBevel.Create(panel1); with panel2 do begin - SetDimensions(40,64,124,56); + SetPosition(40,64,124,56); shape := bsFrame; style := bsLowered; end; - lb2 := TwgLabel.Create(panel2); + lb2 := TfpgLabel.Create(panel2); with lb2 do begin - SetDimensions(32,24,80,16); - Text := u8('Label'); + SetPosition(32,24,80,16); + Text := 'Label'; FontName := '#Label1'; end; diff --git a/examples/apps/uidesigner/uidesigner.lpi b/examples/apps/uidesigner/uidesigner.lpi index 0e92e472..99714a81 100644 --- a/examples/apps/uidesigner/uidesigner.lpi +++ b/examples/apps/uidesigner/uidesigner.lpi @@ -1,7 +1,7 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <PathDelim Value="/"/> + <PathDelim Value="\"/> <Version Value="5"/> <General> <Flags> @@ -9,7 +9,7 @@ </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <IconPath Value="./"/> + <IconPath Value=".\"/> <TargetFileExt Value=""/> <Title Value="uiDesigner"/> </General> @@ -24,7 +24,7 @@ <RunParams> <local> <FormatVersion Value="1"/> - <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> </local> </RunParams> <RequiredPackages Count="1"> @@ -103,6 +103,7 @@ </ProjectOptions> <CompilerOptions> <Version Value="5"/> + <PathDelim Value="\"/> <Parsing> <SyntaxOptions> <AllowLabel Value="False"/> diff --git a/examples/apps/uidesigner/vfdprops.pas b/examples/apps/uidesigner/vfdprops.pas index 0b39a903..d84c1c47 100644 --- a/examples/apps/uidesigner/vfdprops.pas +++ b/examples/apps/uidesigner/vfdprops.pas @@ -249,6 +249,7 @@ begin Edit.SetPosition(0, 0, Width, Height); Edit.Anchors := Anchors; Edit.OnChange := @UpdateProperty; + Edit.Visible := True; end; procedure TGeneralPropertyEditor.LoadIntValue(wg: TfpgWidget); @@ -404,6 +405,7 @@ begin UpdateWindowPosition; Anchors := [anTop, anRight]; OnClick := @OnEditClick; + Visible := True; end; end; @@ -477,6 +479,7 @@ begin chl.SetPosition(0, 0, Width, Height); chl.Anchors := Anchors; chl.OnChange := @UpdateProperty; + chl.Visible := True; end; procedure TChoicePropertyEditor.LoadValue(wg: TfpgWidget); diff --git a/examples/apps/uidesigner/vfdresizer.pas b/examples/apps/uidesigner/vfdresizer.pas index 1298c6ab..5c4185b3 100644 --- a/examples/apps/uidesigner/vfdresizer.pas +++ b/examples/apps/uidesigner/vfdresizer.pas @@ -129,6 +129,7 @@ begin 7: MouseCursor := mcSizeNESW; 8: MouseCursor := mcSizeEW; end; + Visible := True; end; procedure TwgResizer.Show; diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas index 15715769..8e5a1945 100644 --- a/src/corelib/gfx_widget.pas +++ b/src/corelib/gfx_widget.pas @@ -76,6 +76,7 @@ type function FindFocusWidget(startwg: TfpgWidget; direction: TFocusSearchDirection): TfpgWidget; procedure HandleAlignments(dwidth, dheight: TfpgCoord); virtual; procedure HandleShow; virtual; + procedure InternalHandleShow; virtual; procedure HandleHide; virtual; procedure MoveAndResize(aleft, atop, awidth, aheight: TfpgCoord); procedure RePaint; @@ -216,7 +217,8 @@ begin // This is for components that are create at runtime, after it's // parent has already been shown. if (Parent <> nil) and (Parent.HasHandle) then - HandleShow; + InternalHandleShow; +// HandleShow; Exclude(ComponentState, csLoading); end; @@ -475,6 +477,14 @@ begin end; end; +procedure TfpgWidget.InternalHandleShow; +begin + FOnScreen := True; + FVisible := False; + AllocateWindowHandle; + DoSetWindowVisible(False); +end; + procedure TfpgWidget.HandleHide; var n: integer; @@ -803,6 +813,8 @@ var dw: integer; dh: integer; begin + if (csLoading in ComponentState) then + Exit; FAlignRect.Top := 0; FAlignRect.Left := 0; FAlignRect.Width := Width; diff --git a/src/gui/gui_basegrid.pas b/src/gui/gui_basegrid.pas index 357f6795..539e2415 100644 --- a/src/gui/gui_basegrid.pas +++ b/src/gui/gui_basegrid.pas @@ -586,6 +586,8 @@ end; procedure TfpgBaseGrid.HandleResize(awidth, aheight: TfpgCoord); begin inherited HandleResize(awidth, aheight); + if (csLoading in ComponentState) then + Exit; UpdateScrollBars; end; diff --git a/src/gui/gui_memo.pas b/src/gui/gui_memo.pas index c8de2a52..b424a523 100644 --- a/src/gui/gui_memo.pas +++ b/src/gui/gui_memo.pas @@ -1166,7 +1166,8 @@ end; procedure TfpgMemo.HandleResize(dwidth, dheight: integer); begin inherited HandleResize(dwidth, dheight); - + if (csLoading in ComponentState) then + Exit; UpdateScrollBarCoords; UpdateScrollBars; end; diff --git a/src/gui/gui_tree.pas b/src/gui/gui_tree.pas index 5384c97b..d8d4c287 100644 --- a/src/gui/gui_tree.pas +++ b/src/gui/gui_tree.pas @@ -973,6 +973,8 @@ begin writeln(Classname, '.HandleResize'); {$ENDIF} inherited HandleResize(awidth, aheight); + if (csLoading in ComponentState) then + exit; ResetScrollbar; RePaint; end; |