diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-11 15:41:46 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-11 15:41:46 +0000 |
commit | 97dfb85b7f7da2140a91675c499e2c61bfe86a7c (patch) | |
tree | b1f20e0ceaec6fb92c814c6c0736efcc8eda6fde /examples/gui/fontselect | |
parent | aea7c1b24242f0b1e6957937cf600bcb479fb896 (diff) | |
download | fpGUI-97dfb85b7f7da2140a91675c499e2c61bfe86a7c.tar.xz |
* Started implementation of a Font Selection dialog. (not complete)
* Created a new FontSelect example to demo new dialog.
Diffstat (limited to 'examples/gui/fontselect')
-rw-r--r-- | examples/gui/fontselect/fontselect.lpi | 53 | ||||
-rw-r--r-- | examples/gui/fontselect/fontselect.lpr | 76 |
2 files changed, 129 insertions, 0 deletions
diff --git a/examples/gui/fontselect/fontselect.lpi b/examples/gui/fontselect/fontselect.lpi new file mode 100644 index 00000000..18b66abc --- /dev/null +++ b/examples/gui/fontselect/fontselect.lpi @@ -0,0 +1,53 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <TargetFileExt Value=""/> + </General> + <VersionInfo> + <ProjectVersion Value=""/> + </VersionInfo> + <PublishOptions> + <Version Value="2"/> + <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)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpgui_package"/> + <MinVersion Minor="5" Valid="True"/> + </Item1> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="fontselect.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="fontselect"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CustomOptions Value="-FUunits"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/examples/gui/fontselect/fontselect.lpr b/examples/gui/fontselect/fontselect.lpr new file mode 100644 index 00000000..f47d996f --- /dev/null +++ b/examples/gui/fontselect/fontselect.lpr @@ -0,0 +1,76 @@ +program fontselect; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes, + fpgfx, + gui_form, + gui_dialogs, + gui_button; + + +type + TMainForm = class(TfpgForm) + private + btnQuit: TfpgButton; + btnSelectFont: TfpgButton; + procedure btnQuitClick(Sender: TObject); + procedure btnSelectFontClick(Sender: TObject); + public + constructor Create(AOwner: TComponent); override; + end; + +{ TMainForm } + +procedure TMainForm.btnQuitClick(Sender: TObject); +begin + Close; +end; + +procedure TMainForm.btnSelectFontClick(Sender: TObject); +var + frm: TfpgFontSelect; +begin + frm := TfpgFontSelect.Create(nil); + try + if frm.ShowModal = 1 then + begin + // query font selected in dialog + end; + finally + frm.Free; + end; +end; + +constructor TMainForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WindowTitle := 'Font selection test'; + SetPosition(100, 100, 500, 400); + + btnQuit := CreateButton(self, 415, 370, 80, 'Quit', @btnQuitClick); + btnQuit.ImageName := 'stdimg.Quit'; + btnQuit.ShowImage := True; + btnQuit.Anchors := [anRight, anBottom]; + + btnSelectFont := CreateButton(self, 10, 20, 110, 'Select Font...', @btnSelectFontClick); +end; + +procedure MainProc; +var + frm: TMainForm; +begin + fpgApplication.Initialize; + frm := TMainForm.Create(nil); + frm.Show; + fpgApplication.Run; +end; + +begin + MainProc; +end. + |