diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-03 13:10:36 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-03 13:10:36 +0000 |
commit | ec379abe306e8361bf5902c5e20cee66f82ee682 (patch) | |
tree | cbe27b4bbfc0ae98e97f76f0d743220cb069e7d0 /examples/gui | |
parent | 7ff091677fd4ce740336f89f949482b7fa19e5b8 (diff) | |
download | fpGUI-ec379abe306e8361bf5902c5e20cee66f82ee682.tar.xz |
* Implemented BackgroundColor property for TfpgTabSheet.
* Implemented ActivePageIndex and ActivePage properties for TfpgPageControl.
* Implemented Tab Sorting property.
* Implemented Left/Right buttons to scroll tabs.
Diffstat (limited to 'examples/gui')
-rw-r--r-- | examples/gui/tabtest/tabtest.lpi | 7 | ||||
-rw-r--r-- | examples/gui/tabtest/tabtest.lpr | 70 |
2 files changed, 46 insertions, 31 deletions
diff --git a/examples/gui/tabtest/tabtest.lpi b/examples/gui/tabtest/tabtest.lpi index 534add50..7ab1b393 100644 --- a/examples/gui/tabtest/tabtest.lpi +++ b/examples/gui/tabtest/tabtest.lpi @@ -1,7 +1,7 @@ <?xml version="1.0"?> <CONFIG> <ProjectOptions> - <PathDelim Value="\"/> + <PathDelim Value="/"/> <Version Value="5"/> <General> <Flags> @@ -9,7 +9,7 @@ </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <IconPath Value=".\"/> + <IconPath Value="./"/> <TargetFileExt Value=""/> </General> <VersionInfo> @@ -23,7 +23,7 @@ <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"> @@ -42,7 +42,6 @@ </ProjectOptions> <CompilerOptions> <Version Value="5"/> - <PathDelim Value="\"/> <CodeGeneration> <Generate Value="Faster"/> </CodeGeneration> diff --git a/examples/gui/tabtest/tabtest.lpr b/examples/gui/tabtest/tabtest.lpr index 52c0e8c5..47749e14 100644 --- a/examples/gui/tabtest/tabtest.lpr +++ b/examples/gui/tabtest/tabtest.lpr @@ -7,7 +7,7 @@ uses cthreads, {$ENDIF}{$ENDIF} Classes, fpgfx, gfx_widget, gfxbase, gui_form, gui_tab, gui_button, - gui_label, gui_edit; + gui_label, gui_edit, gui_checkbox; type TMainForm = class(TfpgForm) @@ -17,12 +17,13 @@ type tsOne: TfpgTabSheet; tsTwo: TfpgTabSheet; tsThree: TfpgTabSheet; - lbl1, lbl2, lbl3: TfpgLabel; - btn1, btn2, btn3: TfpgButton; - edit1: TfpgEdit; + tsFour: TfpgTabSheet; + btn2, btn3, btn4: TfpgButton; + chkSort: TfpgCheckBox; procedure btnQuitClick(Sender: TObject); procedure btn2Click(Sender: TObject); procedure btn3Click(Sender: TObject); + procedure chkSortChange(Sender: TObject); public constructor Create(AOwner: TComponent); override; end; @@ -36,12 +37,24 @@ end; procedure TMainForm.btn2Click(Sender: TObject); begin - pcMain.ActivePage := tsOne; + pcMain.ActivePageIndex := 0; end; procedure TMainForm.btn3Click(Sender: TObject); +var + i: integer; begin - pcMain.ActivePage := tsTwo; + i := tsFour.PageIndex + 1; + if i > pcMain.PageCount-1 then // we reached the end so start from front + i := 0; + + tsFour.PageIndex := i; +end; + +procedure TMainForm.chkSortChange(Sender: TObject); +begin + pcMain.SortPages := chkSort.Checked; + btn3.Enabled := not chkSort.Checked; end; constructor TMainForm.Create(AOwner: TComponent); @@ -56,42 +69,45 @@ begin btnQuit.Anchors := [anRight, anBottom]; pcMain := TfpgPageControl.Create(self); - pcMain.Top := 10; - pcMain.Left := 10; - pcMain.Width := Width - 20; - pcMain.Height := 300; - pcMain.Anchors := [anLeft, anTop, anRight, anBottom]; + pcMain.Top := 10; + pcMain.Left := 10; + pcMain.Width := Width - 20; + pcMain.Height := 300; + pcMain.Anchors := [anLeft, anTop, anRight, anBottom]; // Tab One tsOne := TfpgTabSheet.Create(pcMain); tsOne.Text := 'Tab One'; - tsOne.Top := 50; - - tsOne.Left := 10; - tsOne.Width := Width - 20; - tsOne.Height := 200; - - lbl1 := CreateLabel(tsOne, 50, 50, 'TabSheet One'); - edit1 := CreateEdit(tsOne, 50, 100, 150, 25); + CreateLabel(tsOne, 15, 50, 'TabSheet One'); + CreateLabel(tsOne, 15, 30, 'Resize form to see PageControl left/right buttons in action.'); + CreateEdit(tsOne, 15, 100, 150, 25); // Tab Two tsTwo := TfpgTabSheet.Create(pcMain); tsTwo.Text := 'Tab Two'; - tsTwo.Top := 50; - - lbl2 := CreateLabel(tsTwo, 50, 50, 'TabSheet Two'); - btn1 := CreateButton(tsTwo, 50, 100, 80, 'Button1', nil); + CreateLabel(tsTwo, 50, 50, 'TabSheet Two'); + CreateButton(tsTwo, 50, 100, 80, 'Button1', nil); // Tab Three tsThree := TfpgTabSheet.Create(pcMain); tsThree.Text := 'Tab Three'; - tsThree.Top := 50; - - lbl3 := CreateLabel(tsThree, 50, 50, 'TabSheet Three'); + CreateLabel(tsThree, 80, 50, 'TabSheet Three'); + + // Tab Four + tsFour := TfpgTabSheet.Create(pcMain); + tsFour.Text := 'This is one long text caption'; + tsFour.BackgroundColor := clMediumSeaGreen; + + pcMain.ActivePage := tsOne; btn2 := CreateButton(self, 10, 320, 80, 'Page 1', @btn2Click); - btn3 := CreateButton(self, 100, 320, 80, 'Page 2', @btn3Click); + btn2.Anchors := [anLeft, anBottom]; + btn3 := CreateButton(self, 100, 320, 80, 'Reorder Tab', @btn3Click); + btn3.Anchors := [anLeft, anBottom]; + + chkSort := CreateCheckBox(self, 190, 320, 'Sort Tabs'); + chkSort.OnChange := @chkSortChange; end; procedure MainProc; |