diff options
Diffstat (limited to 'examples/gui/helloworld')
-rw-r--r-- | examples/gui/helloworld/helloworld.lpi | 9 | ||||
-rw-r--r-- | examples/gui/helloworld/helloworld.pas | 56 |
2 files changed, 51 insertions, 14 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. |