diff options
author | Andrew Haines <andrewd207@aol.com> | 2014-07-21 22:00:56 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2014-07-21 22:02:42 +0100 |
commit | 84d9c47dee2a6c27e4c8ce467fe618591104977f (patch) | |
tree | 2dae2fd0c05679a97834e182fbfb9ea8265904c0 /examples | |
parent | 1bd4b9091d3649f531c77ef0d0d656de4f6e3129 (diff) | |
download | fpGUI-84d9c47dee2a6c27e4c8ce467fe618591104977f.tar.xz |
new ToggleBox widget
Hi I made a Togglebox widget descended from TfpgComboBox. It has button
that slides side to side for checked/unchecked with a subtle animation
when toggled. Various colors can be changed and the animation disabled.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/gui/togglebox/ToggleBoxTest.lpi | 77 | ||||
-rw-r--r-- | examples/gui/togglebox/ToggleBoxTest.lpr | 30 | ||||
-rw-r--r-- | examples/gui/togglebox/mainfrm.pas | 44 |
3 files changed, 151 insertions, 0 deletions
diff --git a/examples/gui/togglebox/ToggleBoxTest.lpi b/examples/gui/togglebox/ToggleBoxTest.lpi new file mode 100644 index 00000000..327b4258 --- /dev/null +++ b/examples/gui/togglebox/ToggleBoxTest.lpi @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="ToggleBoxTest"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication Use="True" PathPlusParams="/usr/bin/gnome-terminal -t 'Lazarus Run Output' -e '$(LazarusDir)/tools/runwait.sh $(TargetCmdLine)'"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpgui_toolkit"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="ToggleBoxTest.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="mainfrm.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="mainfrm"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="ToggleBoxTest"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/examples/gui/togglebox/ToggleBoxTest.lpr b/examples/gui/togglebox/ToggleBoxTest.lpr new file mode 100644 index 00000000..8866f9c5 --- /dev/null +++ b/examples/gui/togglebox/ToggleBoxTest.lpr @@ -0,0 +1,30 @@ +program ToggleBoxTest; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX} + cthreads, + {$ENDIF} + Classes, + fpg_main, + mainfrm; + +procedure MainProc; +var + frmMain: TfrmMain; +begin + fpgApplication.Initialize; + frmMain:= TfrmMain.Create(nil); + try + frmMain.Show; + fpgApplication.Run; + finally + frmMain.Free; + end; +end; + +begin + MainProc; +end. + diff --git a/examples/gui/togglebox/mainfrm.pas b/examples/gui/togglebox/mainfrm.pas new file mode 100644 index 00000000..ff9a43da --- /dev/null +++ b/examples/gui/togglebox/mainfrm.pas @@ -0,0 +1,44 @@ +unit mainfrm; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, fpg_base, fpg_form, fpg_toggle; + +type + + { TfrmMain } + + TfrmMain = class(TfpgForm) + private + FToggle: TfpgToggle; + public + constructor Create(AOwner: TComponent); override; + end; + + +implementation + +{ TfrmMain } + +constructor TfrmMain.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WindowTitle:='Yay a toggle!'; + SetWidth(300); + SetHeight(200); + + FToggle := TfpgToggle.Create(Self); + FToggle.SetPosition(10, 10, 200, 20); +// FToggle.Width:=200; + + //FToggle.ToggleSide:=tsLeft; + //FToggle.ToggleWidth:=100; + //FToggle.UseAnimation:=False; + +end; + +end. + |