summaryrefslogtreecommitdiff
path: root/examples/gui/helloworld/helloworld.pas
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@users.sourceforge.net>2007-01-23 14:48:31 +0000
committerGraeme Geldenhuys <graemeg@users.sourceforge.net>2007-01-23 14:48:31 +0000
commitc0fe0b96fa12d2ce8b7ff0d2d929c5b2181135f7 (patch)
tree59e9a7de4871633cafdfaf77e442c0d656d582ce /examples/gui/helloworld/helloworld.pas
parent07a6706d95e5a97e610eba483b13217367a193d3 (diff)
downloadfpGUI-c0fe0b96fa12d2ce8b7ff0d2d929c5b2181135f7.tar.xz
* MouseLeaveCheck no fires off a MouseEnter and MouseLeave event for widgets.
This makes writing other widgets easier. * Fixed the button size of the TComboBox widget. * Fixed the examples/gui/helloworld application. * Added a extras directory where we can store all kinds of stuff. Currently I added a Lazarus code template for creating a new fpGUI application. * Fixed a bug in fpGFX/X11 where the OnEnter event was checked when in actual fact the OnLeave event occured. * Fixed up some code to start Xft support for Linux again. * Internal or composite widgets like the Button in the ComboBox are now named with a hash and then the name.
Diffstat (limited to 'examples/gui/helloworld/helloworld.pas')
-rw-r--r--examples/gui/helloworld/helloworld.pas56
1 files changed, 48 insertions, 8 deletions
diff --git a/examples/gui/helloworld/helloworld.pas b/examples/gui/helloworld/helloworld.pas
index b9921756..b09ec498 100644
--- a/examples/gui/helloworld/helloworld.pas
+++ b/examples/gui/helloworld/helloworld.pas
@@ -3,20 +3,60 @@ program HelloWorld;
{$mode objfpc}{$h+}
uses
- fpGUI, fpguipackage;
+ fpGUI
+ ,fpGFX { GFApplication }
+ ,gfxBase
+ ;
type
TMainForm = class(TForm)
- TextLabel: TLabel;
- lblClose: TLabel;
+ private
+ BoxLayout: TBoxLayout;
+ btnHello: TButton;
+ public
+ procedure AfterConstruction; override;
end;
+
+{ TMainForm }
+
+procedure TMainForm.AfterConstruction;
var
- MainForm: TMainForm;
+ lSize: TSize;
+begin
+ inherited AfterConstruction;
+ Name := 'MainForm';
+ BorderWidth := 8;
+ Text := 'fpGUI Application';
+
+ { every fpGUI app needs a layout manager }
+ BoxLayout := TBoxLayout.Create(self);
+ BoxLayout.Spacing := 8;
+ BoxLayout.VertAlign := vertFill;
+ InsertChild(BoxLayout);
+
+ { create our button }
+ btnHello := TButton.Create('Hello World!', self);
+ btnHello.CanExpandWidth := True;
+ btnHello.CanExpandHeight := True;
+ BoxLayout.InsertChild(btnHello);
+ { set a min and max size }
+ lSize.cx := 150;
+ lSize.cy := 100;
+ Wnd.SetMinMaxClientSize(lSize, lSize);
+end;
+
+
+var
+ MainForm: TMainForm;
begin
- Application.CreateForm(TMainForm, MainForm);
-
- Application.Run;
- MainForm.Free;
+ GFApplication.Initialize;
+ MainForm := TMainForm.Create(GFApplication);
+ try
+ MainForm.Show;
+ GFApplication.Run;
+ finally
+ MainForm.Free;
+ end;
end.