summaryrefslogtreecommitdiff
path: root/examples/gui
diff options
context:
space:
mode:
Diffstat (limited to 'examples/gui')
-rw-r--r--examples/gui/helloworld/helloworld.lpi9
-rw-r--r--examples/gui/helloworld/helloworld.pas56
-rw-r--r--examples/gui/utfdemo/utfdemo.lpr1
-rw-r--r--examples/gui/widgettest/widgettest.lpi1
4 files changed, 51 insertions, 16 deletions
diff --git a/examples/gui/helloworld/helloworld.lpi b/examples/gui/helloworld/helloworld.lpi
index c180f8dc..e0302f2b 100644
--- a/examples/gui/helloworld/helloworld.lpi
+++ b/examples/gui/helloworld/helloworld.lpi
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="\"/>
+ <PathDelim Value="/"/>
<Version Value="5"/>
<General>
<Flags>
@@ -14,15 +14,13 @@
</General>
<PublishOptions>
<Version Value="2"/>
- <DestinationDirectory Value="$(TestDir)\publishedproject\"/>
- <IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<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">
@@ -40,9 +38,8 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
- <PathDelim Value="\"/>
<SearchPaths>
- <OtherUnitFiles Value="..\..\src\"/>
+ <OtherUnitFiles Value="../../src/"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
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.
diff --git a/examples/gui/utfdemo/utfdemo.lpr b/examples/gui/utfdemo/utfdemo.lpr
index c3c7ba6c..b59f7f96 100644
--- a/examples/gui/utfdemo/utfdemo.lpr
+++ b/examples/gui/utfdemo/utfdemo.lpr
@@ -63,7 +63,6 @@ begin
GFApplication.Initialize;
MainForm := TMainForm.Create(GFApplication);
try
- GFApplication.AddWindow(MainForm.Wnd); { I don't like this! }
MainForm.Show;
GFApplication.Run;
finally
diff --git a/examples/gui/widgettest/widgettest.lpi b/examples/gui/widgettest/widgettest.lpi
index 0fe05a78..efbb9314 100644
--- a/examples/gui/widgettest/widgettest.lpi
+++ b/examples/gui/widgettest/widgettest.lpi
@@ -6,7 +6,6 @@
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
- <AlwaysBuild Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>