mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-21 09:42:12 +01:00
added groupboxnested example
git-svn-id: trunk@4468 -
This commit is contained in:
parent
51083ebbab
commit
820129a7e4
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -266,6 +266,7 @@ examples/comdialogs.pp svneol=native#text/pascal
|
|||||||
examples/dlgform.pp svneol=native#text/pascal
|
examples/dlgform.pp svneol=native#text/pascal
|
||||||
examples/edittest.pp svneol=native#text/pascal
|
examples/edittest.pp svneol=native#text/pascal
|
||||||
examples/groupbox.pp svneol=native#text/pascal
|
examples/groupbox.pp svneol=native#text/pascal
|
||||||
|
examples/groupboxnested.pas svneol=native#text/pascal
|
||||||
examples/gtkglarea/data/particle.bmp -text svneol=unset#image/bmp
|
examples/gtkglarea/data/particle.bmp -text svneol=unset#image/bmp
|
||||||
examples/gtkglarea/data/texture1.bmp -text svneol=unset#image/bmp
|
examples/gtkglarea/data/texture1.bmp -text svneol=unset#image/bmp
|
||||||
examples/gtkglarea/data/texture2.bmp -text svneol=unset#image/bmp
|
examples/gtkglarea/data/texture2.bmp -text svneol=unset#image/bmp
|
||||||
|
|||||||
@ -212,8 +212,8 @@ LCL_PLATFORM=gtk
|
|||||||
endif
|
endif
|
||||||
export LCL_PLATFORM
|
export LCL_PLATFORM
|
||||||
endif
|
endif
|
||||||
override TARGET_UNITS+=hello notebk comdialogs progressbar trackbar listboxtest bitbutton combobox checkbox scrollbar edittest memotest groupbox speedtest toolbar messagedialogs notebooktest listviewtest synedit1 testall
|
override TARGET_UNITS+=hello notebk comdialogs progressbar trackbar listboxtest bitbutton combobox checkbox scrollbar edittest memotest groupbox speedtest toolbar messagedialogs notebooktest listviewtest synedit1 groupboxnested testall
|
||||||
override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) trackbar toolbar testall speedtest scrollbar progressbar notebooktest notebk messagedialogs memotest listviewtest listboxtest hello groupbox edittest comdialogs combobox checkbox bitbutton synedit1
|
override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) trackbar toolbar testall speedtest scrollbar progressbar notebooktest notebk messagedialogs memotest listviewtest listboxtest hello groupbox edittest comdialogs combobox checkbox bitbutton synedit1 groupboxnested
|
||||||
override COMPILER_OPTIONS+=-gl
|
override COMPILER_OPTIONS+=-gl
|
||||||
override COMPILER_UNITDIR+=../lcl/units ../lcl/units/$(LCL_PLATFORM) ../components/units .. .
|
override COMPILER_UNITDIR+=../lcl/units ../lcl/units/$(LCL_PLATFORM) ../components/units .. .
|
||||||
ifdef REQUIRE_UNITSDIR
|
ifdef REQUIRE_UNITSDIR
|
||||||
|
|||||||
@ -10,7 +10,7 @@ version=0.9b
|
|||||||
units=hello notebk comdialogs progressbar trackbar listboxtest \
|
units=hello notebk comdialogs progressbar trackbar listboxtest \
|
||||||
bitbutton combobox checkbox scrollbar edittest memotest \
|
bitbutton combobox checkbox scrollbar edittest memotest \
|
||||||
groupbox speedtest toolbar messagedialogs notebooktest \
|
groupbox speedtest toolbar messagedialogs notebooktest \
|
||||||
listviewtest synedit1 testall
|
listviewtest synedit1 groupboxnested testall
|
||||||
|
|
||||||
[require]
|
[require]
|
||||||
packages=fcl regexpr
|
packages=fcl regexpr
|
||||||
@ -19,7 +19,7 @@ packages=fcl regexpr
|
|||||||
files=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) \
|
files=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) \
|
||||||
trackbar toolbar testall speedtest scrollbar progressbar notebooktest \
|
trackbar toolbar testall speedtest scrollbar progressbar notebooktest \
|
||||||
notebk messagedialogs memotest listviewtest listboxtest hello groupbox \
|
notebk messagedialogs memotest listviewtest listboxtest hello groupbox \
|
||||||
edittest comdialogs combobox checkbox bitbutton synedit1
|
edittest comdialogs combobox checkbox bitbutton synedit1 groupboxnested
|
||||||
|
|
||||||
[default]
|
[default]
|
||||||
|
|
||||||
|
|||||||
@ -32,13 +32,11 @@ program GroupBox;
|
|||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Interfaces, Classes, StdCtrls, Forms, Buttons, Menus, ComCtrls,
|
Interfaces, Classes, StdCtrls, Forms, Buttons, Menus, ComCtrls, SysUtils;
|
||||||
SysUtils;
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TForm1 = class(TFORM)
|
TForm1 = class(TFORM)
|
||||||
public
|
public
|
||||||
|
|
||||||
Button1: TButton;
|
Button1: TButton;
|
||||||
Button2: TButton;
|
Button2: TButton;
|
||||||
Button3: TButton;
|
Button3: TButton;
|
||||||
@ -46,7 +44,7 @@ type
|
|||||||
grpTst : TGroupBox;
|
grpTst : TGroupBox;
|
||||||
mnuFile: TMainMenu;
|
mnuFile: TMainMenu;
|
||||||
itmFileQuit: TMenuItem;
|
itmFileQuit: TMenuItem;
|
||||||
CheckBox1 : TCheckBox;
|
CheckBox1: TCheckBox;
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure LoadMainMenu;
|
procedure LoadMainMenu;
|
||||||
procedure mnuQuitClicked(Sender : TObject);
|
procedure mnuQuitClicked(Sender : TObject);
|
||||||
@ -57,8 +55,7 @@ type
|
|||||||
procedure Button4CLick(Sender : TObject);
|
procedure Button4CLick(Sender : TObject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var Form1 : TForm1;
|
||||||
Form1 : TForm1;
|
|
||||||
|
|
||||||
constructor TForm1.Create(AOwner: TComponent);
|
constructor TForm1.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
@ -98,86 +95,86 @@ End;
|
|||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
procedure TForm1.LoadMainMenu;
|
procedure TForm1.LoadMainMenu;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ set the height and width }
|
{ set the height and width }
|
||||||
Height := 350;
|
Height := 350;
|
||||||
Width := 700;
|
Width := 700;
|
||||||
|
|
||||||
{ Create a groupbox }
|
{ Create a groupbox }
|
||||||
grpTst := TGroupBox.Create(Self);
|
grpTst := TGroupBox.Create(Self);
|
||||||
grpTst.Parent := self;
|
with grpTst do begin
|
||||||
grpTst.top := 70;
|
Name:='grpTst';
|
||||||
grpTst.left := 10;
|
Parent := self;
|
||||||
grpTst.Height :=200;
|
top := 70;
|
||||||
grpTst.Width := 300;
|
left := 10;
|
||||||
grpTst.Show;
|
Height :=200;
|
||||||
grpTst.Caption := 'Groupbox with 2 Buttons';
|
Width := 300;
|
||||||
|
Caption := 'Groupbox with 2 Buttons';
|
||||||
|
end;
|
||||||
|
|
||||||
{ Create 2 buttons inside the groupbox }
|
{ Create 2 buttons inside the groupbox }
|
||||||
if assigned (grpTst) then
|
if assigned (grpTst) then
|
||||||
begin
|
begin
|
||||||
Button2 := TButton.Create(grpTst);
|
Button2 := TButton.Create(grpTst);
|
||||||
Button2.Parent := grpTst;
|
Button2.Parent := grpTst;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
Button2 := TButton.Create(Self);
|
Button2 := TButton.Create(Self);
|
||||||
Button2.Parent := Self;
|
Button2.Parent := Self;
|
||||||
end;
|
end;
|
||||||
Button2.Left := 200;
|
Button2.Name:='Button2';
|
||||||
Button2.Top := 50;
|
Button2.Left := 200;
|
||||||
Button2.Width := 80;
|
Button2.Top := 50;
|
||||||
Button2.Height := 30;
|
Button2.Width := 80;
|
||||||
Button2.Show;
|
Button2.Height := 30;
|
||||||
Button2.Caption := 'Width ++';
|
Button2.Caption := 'Width ++';
|
||||||
Button2.OnClick := @Button2Click;
|
Button2.OnClick := @Button2Click;
|
||||||
|
|
||||||
|
|
||||||
if assigned (grpTst) then
|
if assigned (grpTst) then
|
||||||
begin
|
begin
|
||||||
Button1 := TButton.Create(grpTst);
|
Button1 := TButton.Create(grpTst);
|
||||||
Button1.Parent := grpTst;
|
Button1.Parent := grpTst;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
Button1 := TButton.Create(Self);
|
Button1 := TButton.Create(Self);
|
||||||
Button1.Parent := Self;
|
Button1.Parent := Self;
|
||||||
end;
|
end;
|
||||||
Button1.Left := 50;
|
Button1.Name:='Button1';
|
||||||
Button1.Top := 50;
|
Button1.Left := 50;
|
||||||
Button1.Width := 80;
|
Button1.Top := 50;
|
||||||
Button1.Height := 30;
|
Button1.Width := 80;
|
||||||
Button1.Show;
|
Button1.Height := 30;
|
||||||
Button1.Caption := 'Height++';
|
Button1.Caption := 'Height++';
|
||||||
Button1.OnClick := @Button1Click;
|
Button1.OnClick := @Button1Click;
|
||||||
|
|
||||||
{ Create 2 more buttons outside the groupbox }
|
{ Create 2 more buttons outside the groupbox }
|
||||||
Button3 := TButton.Create(Self);
|
Button3 := TButton.Create(Self);
|
||||||
Button3.Parent := Self;
|
Button3.Name:='Button3';
|
||||||
Button3.Left := 50;
|
Button3.Parent := Self;
|
||||||
Button3.Top := 30;
|
Button3.Left := 50;
|
||||||
Button3.Width := 80;
|
Button3.Top := 30;
|
||||||
Button3.Height := 30;
|
Button3.Width := 80;
|
||||||
Button3.Show;
|
Button3.Height := 30;
|
||||||
Button3.Caption := 'Show';
|
Button3.Caption := 'Show';
|
||||||
Button3.OnClick := @Button3Click;
|
Button3.OnClick := @Button3Click;
|
||||||
|
|
||||||
Button4 := TButton.Create(Self);
|
Button4 := TButton.Create(Self);
|
||||||
Button4.Parent := Self;
|
Button4.Name:='Button4';
|
||||||
Button4.Left := 200;
|
Button4.Parent := Self;
|
||||||
Button4.Top := 30;
|
Button4.Left := 200;
|
||||||
Button4.Width := 80;
|
Button4.Top := 30;
|
||||||
Button4.Height := 30;
|
Button4.Width := 80;
|
||||||
Button4.Show;
|
Button4.Height := 30;
|
||||||
Button4.Caption := 'Hide';
|
Button4.Caption := 'Hide';
|
||||||
Button4.OnClick := @Button4Click;
|
Button4.OnClick := @Button4Click;
|
||||||
|
|
||||||
mnuFile := TMainMenu.Create(Self);
|
mnuFile := TMainMenu.Create(Self);
|
||||||
|
|
||||||
itmFileQuit := TMenuItem.Create(Self);
|
|
||||||
itmFileQuit.Caption := 'Quit';
|
|
||||||
itmFileQuit.OnClick := @mnuQuitClicked;
|
|
||||||
mnuFile.Items.Add(itmFileQuit);
|
|
||||||
|
|
||||||
|
itmFileQuit := TMenuItem.Create(Self);
|
||||||
|
itmFileQuit.Caption := 'Quit';
|
||||||
|
itmFileQuit.OnClick := @mnuQuitClicked;
|
||||||
|
mnuFile.Items.Add(itmFileQuit);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
|
|||||||
76
examples/groupboxnested.pas
Normal file
76
examples/groupboxnested.pas
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
{ $Id$ }
|
||||||
|
{
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* This source is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This code is distributed in the hope that it will be useful, but *
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||||
|
* General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* A copy of the GNU General Public License is available on the World *
|
||||||
|
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
|
||||||
|
* obtain it by writing to the Free Software Foundation, *
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
}
|
||||||
|
program GroupBoxNested;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
Interfaces, Classes, SysUtils, StdCtrls, Forms, Controls;
|
||||||
|
|
||||||
|
type
|
||||||
|
TForm1 = class(TFORM)
|
||||||
|
GroupBox1: TGroupBox;
|
||||||
|
GroupBox2: TGroupBox;
|
||||||
|
GroupBox3: TGroupBox;
|
||||||
|
public
|
||||||
|
constructor Create(TheOwner: TComponent); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
constructor TForm1.Create(TheOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(TheOwner);
|
||||||
|
Name:='Form1';
|
||||||
|
Caption:='Nested Groupbox demo';
|
||||||
|
SetBounds(100,50,300,250);
|
||||||
|
|
||||||
|
GroupBox1:=TGroupBox.Create(Self);
|
||||||
|
with GroupBox1 do begin
|
||||||
|
Name:='GroupBox1';
|
||||||
|
Parent:=Self;
|
||||||
|
Align:=alClient;
|
||||||
|
end;
|
||||||
|
|
||||||
|
GroupBox2:=TGroupBox.Create(Self);
|
||||||
|
with GroupBox2 do begin
|
||||||
|
Name:='GroupBox2';
|
||||||
|
Parent:=GroupBox1;
|
||||||
|
Align:=alClient;
|
||||||
|
end;
|
||||||
|
|
||||||
|
GroupBox3:=TGroupBox.Create(Self);
|
||||||
|
with GroupBox3 do begin
|
||||||
|
Name:='GroupBox3';
|
||||||
|
Parent:=GroupBox2;
|
||||||
|
Align:=alClient;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var Form1 : TForm1;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Application.Initialize;
|
||||||
|
Application.CreateForm(TForm1, Form1);
|
||||||
|
Application.Run;
|
||||||
|
end.
|
||||||
|
|
||||||
@ -639,9 +639,9 @@ end;
|
|||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
procedure TWinControl.InvalidateClientRectCache;
|
procedure TWinControl.InvalidateClientRectCache;
|
||||||
begin
|
begin
|
||||||
{$IFDEF VerboseClientRectBugFix}
|
{ $IFDEF VerboseClientRectBugFix}
|
||||||
writeln('[TWinControl.InvalidateClientRectCache] ',Name,':',ClassName);
|
writeln('[TWinControl.InvalidateClientRectCache] ',Name,':',ClassName);
|
||||||
{$ENDIF}
|
{ $ENDIF}
|
||||||
Include(FFlags,wcfClientRectNeedsUpdate);
|
Include(FFlags,wcfClientRectNeedsUpdate);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -656,7 +656,7 @@ end;
|
|||||||
example just puts resize requests into a queue. The LCL resizes the childs
|
example just puts resize requests into a queue. The LCL resizes the childs
|
||||||
just after this procedure due to the clientrect. On complex forms with lots
|
just after this procedure due to the clientrect. On complex forms with lots
|
||||||
of nested controls, this results in thousands of resizes.
|
of nested controls, this results in thousands of resizes.
|
||||||
Changing the clientrect in the LCL to the most probable size reduce
|
Changing the clientrect in the LCL to the most probable size reduces
|
||||||
unneccessary resizes.
|
unneccessary resizes.
|
||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
procedure TWinControl.DoSetBounds(ALeft, ATop, AWidth, AHeight : integer);
|
procedure TWinControl.DoSetBounds(ALeft, ATop, AWidth, AHeight : integer);
|
||||||
@ -2880,6 +2880,8 @@ var
|
|||||||
NewBounds: TRect;
|
NewBounds: TRect;
|
||||||
begin
|
begin
|
||||||
NewBounds:=Bounds(Left, Top, Width, Height);
|
NewBounds:=Bounds(Left, Top, Width, Height);
|
||||||
|
writeln('TWinControl.DoSendBoundsToInterface A ',Name,':',ClassName,' Old=',FBoundsRealized.Left,',',FBoundsRealized.Top,',',FBoundsRealized.Right,',',FBoundsRealized.Bottom,
|
||||||
|
' New=',NewBounds.Left,',',NewBounds.Top,',',NewBounds.Right,',',NewBounds.Bottom);
|
||||||
FBoundsRealized:=NewBounds;
|
FBoundsRealized:=NewBounds;
|
||||||
CNSendMessage(LM_SetSize, Self, @NewBounds);
|
CNSendMessage(LM_SetSize, Self, @NewBounds);
|
||||||
end;
|
end;
|
||||||
@ -2946,6 +2948,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.158 2003/08/12 16:04:22 mattias
|
||||||
|
added groupboxnested example
|
||||||
|
|
||||||
Revision 1.157 2003/08/12 14:02:54 mattias
|
Revision 1.157 2003/08/12 14:02:54 mattias
|
||||||
fixed keypress/keyup, createcaret on synedit focus
|
fixed keypress/keyup, createcaret on synedit focus
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user