diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-15 22:46:28 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-15 22:46:28 +0000 |
commit | ba207d0e5ca65ab32a5435143aaa24d57f19d89a (patch) | |
tree | db7bd727bbbc5d1b1ebae8b653421adb176a29ad /examples/gui/gridtest | |
parent | 056bebf239841b80a09d5e574cc54f15060f0176 (diff) | |
download | fpGUI-ba207d0e5ca65ab32a5435143aaa24d57f19d89a.tar.xz |
* Fixed bug in Horz and Vert scrollbars where they didn't follow
position while scrolling with the mouse wheel.
Diffstat (limited to 'examples/gui/gridtest')
-rw-r--r-- | examples/gui/gridtest/gridtest.lpi | 107 | ||||
-rw-r--r-- | examples/gui/gridtest/gridtest.lpr | 244 |
2 files changed, 176 insertions, 175 deletions
diff --git a/examples/gui/gridtest/gridtest.lpi b/examples/gui/gridtest/gridtest.lpi index 9b698ffe..ff9c418c 100644 --- a/examples/gui/gridtest/gridtest.lpi +++ b/examples/gui/gridtest/gridtest.lpi @@ -1,53 +1,54 @@ -<?xml version="1.0"?> -<CONFIG> - <ProjectOptions> - <PathDelim Value="/"/> - <Version Value="5"/> - <General> - <Flags> - <SaveOnlyProjectUnits Value="True"/> - </Flags> - <SessionStorage Value="InProjectDir"/> - <MainUnit Value="0"/> - <IconPath Value="./"/> - <TargetFileExt Value=""/> - </General> - <VersionInfo> - <ProjectVersion Value=""/> - </VersionInfo> - <PublishOptions> - <Version Value="2"/> - <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="gridtest.lpr"/> - <IsPartOfProject Value="True"/> - <UnitName Value="gridtest"/> - </Unit0> - </Units> - </ProjectOptions> - <CompilerOptions> - <Version Value="5"/> - <CodeGeneration> - <Generate Value="Faster"/> - </CodeGeneration> - <Other> - <CustomOptions Value="-FUunits"/> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> -</CONFIG> +<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <PathDelim Value="\"/>
+ <Version Value="5"/>
+ <General>
+ <Flags>
+ <SaveOnlyProjectUnits Value="True"/>
+ </Flags>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <IconPath Value=".\"/>
+ <TargetFileExt Value=""/>
+ </General>
+ <VersionInfo>
+ <ProjectVersion Value=""/>
+ </VersionInfo>
+ <PublishOptions>
+ <Version Value="2"/>
+ <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="gridtest.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="gridtest"/>
+ </Unit0>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <PathDelim Value="\"/>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CustomOptions Value="-FUunits"/>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+</CONFIG>
diff --git a/examples/gui/gridtest/gridtest.lpr b/examples/gui/gridtest/gridtest.lpr index 3f461155..60d75cdc 100644 --- a/examples/gui/gridtest/gridtest.lpr +++ b/examples/gui/gridtest/gridtest.lpr @@ -1,122 +1,122 @@ -program gridtest; - -{$mode objfpc}{$H+} - -uses - {$IFDEF UNIX}{$IFDEF UseCThreads} - cthreads, - {$ENDIF}{$ENDIF} - Classes, - SysUtils, - fpgfx, - gui_form, - gui_customgrid, - gui_button, - gui_checkbox; - - -type - - TMainForm = class(TfpgForm) - private - btnQuit: TfpgButton; - grdMain: TfpgGrid; - chkShowHeader: TfpgCheckBox; - chkShowGrid: TfpgCheckBox; - chkRowSelect: TfpgCheckBox; - chkDisabled: TfpgCheckBox; - procedure chkDisabledChange(Sender: TObject); - procedure chkRowSelectChange(Sender: TObject); - procedure chkShowHeaderChange(Sender: TObject); - procedure chkShowGridChange(Sender: TObject); - procedure btnQuitClick(Sender: TObject); - public - constructor Create(AOwner: TComponent); override; - end; - -{ TMainForm } - -procedure TMainForm.chkDisabledChange(Sender: TObject); -begin - grdMain.Enabled := not chkDisabled.Checked; -end; - -procedure TMainForm.chkRowSelectChange(Sender: TObject); -begin - grdMain.RowSelect := chkRowSelect.Checked; -end; - -procedure TMainForm.chkShowHeaderChange(Sender: TObject); -begin - grdMain.ShowHeader := chkShowHeader.Checked; -end; - -procedure TMainForm.chkShowGridChange(Sender: TObject); -begin - grdMain.ShowGrid := chkShowGrid.Checked; -end; - -procedure TMainForm.btnQuitClick(Sender: TObject); -begin - Close; -end; - -constructor TMainForm.Create(AOwner: TComponent); -var - c: integer; -begin - inherited Create(AOwner); - WindowTitle := 'Grid control test'; - SetPosition(100, 100, 566, 350); - - btnQuit := CreateButton(self, 476, 320, 80, 'Quit', @btnQuitClick); - btnQuit.ImageName := 'stdimg.Quit'; - btnQuit.ShowImage := True; - btnQuit.Anchors := [anRight, anBottom]; - - grdMain := TfpgGrid.Create(self); - grdMain.Top := 10; - grdMain.Left := 10; - grdMain.Width := Width - 20; - grdMain.Height := 300; - grdMain.Anchors := [anLeft, anTop, anRight, anBottom]; - grdMain.RowCount := 25; - for c := 1 to grdMain.ColumnCount do - grdMain.Columns[c-1].Title := 'Title ' + IntToStr(c); - - chkShowHeader := CreateCheckBox(self, 10, 320, 'Show Header'); - chkShowHeader.Checked := True; - chkShowHeader.OnChange := @chkShowHeaderChange; - chkShowHeader.Anchors := [anLeft, anBottom]; - - chkShowGrid := CreateCheckBox(self, chkShowHeader.Right+10, 320, 'Show Grid'); - chkShowGrid.Checked := True; - chkShowGrid.OnChange := @chkShowGridChange; - chkShowGrid.Anchors := [anLeft, anBottom]; - - chkRowSelect := CreateCheckBox(self, chkShowGrid.Right+10, 320, 'Row Select'); - chkRowSelect.Checked := False; - chkRowSelect.OnChange := @chkRowSelectChange; - chkRowSelect.Anchors := [anLeft, anBottom]; - - chkDisabled := CreateCheckBox(self, chkRowSelect.Right+10, 320, 'Disabled'); - chkDisabled.Checked := False; - chkDisabled.OnChange := @chkDisabledChange; - chkDisabled.Anchors := [anLeft, anBottom]; -end; - - -procedure MainProc; -var - frm: TMainForm; -begin - fpgApplication.Initialize; - frm := TMainForm.Create(nil); - frm.Show; - fpgApplication.Run; -end; - -begin - MainProc; -end. - +program gridtest;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Classes,
+ SysUtils,
+ fpgfx,
+ gui_form,
+ gui_grid,
+ gui_button,
+ gui_checkbox;
+
+
+type
+
+ TMainForm = class(TfpgForm)
+ private
+ btnQuit: TfpgButton;
+ grdMain: TfpgGrid;
+ chkShowHeader: TfpgCheckBox;
+ chkShowGrid: TfpgCheckBox;
+ chkRowSelect: TfpgCheckBox;
+ chkDisabled: TfpgCheckBox;
+ procedure chkDisabledChange(Sender: TObject);
+ procedure chkRowSelectChange(Sender: TObject);
+ procedure chkShowHeaderChange(Sender: TObject);
+ procedure chkShowGridChange(Sender: TObject);
+ procedure btnQuitClick(Sender: TObject);
+ public
+ constructor Create(AOwner: TComponent); override;
+ end;
+
+{ TMainForm }
+
+procedure TMainForm.chkDisabledChange(Sender: TObject);
+begin
+ grdMain.Enabled := not chkDisabled.Checked;
+end;
+
+procedure TMainForm.chkRowSelectChange(Sender: TObject);
+begin
+ grdMain.RowSelect := chkRowSelect.Checked;
+end;
+
+procedure TMainForm.chkShowHeaderChange(Sender: TObject);
+begin
+ grdMain.ShowHeader := chkShowHeader.Checked;
+end;
+
+procedure TMainForm.chkShowGridChange(Sender: TObject);
+begin
+ grdMain.ShowGrid := chkShowGrid.Checked;
+end;
+
+procedure TMainForm.btnQuitClick(Sender: TObject);
+begin
+ Close;
+end;
+
+constructor TMainForm.Create(AOwner: TComponent);
+var
+ c: integer;
+begin
+ inherited Create(AOwner);
+ WindowTitle := 'Grid control test';
+ SetPosition(100, 100, 566, 350);
+
+ btnQuit := CreateButton(self, 476, 320, 80, 'Quit', @btnQuitClick);
+ btnQuit.ImageName := 'stdimg.Quit';
+ btnQuit.ShowImage := True;
+ btnQuit.Anchors := [anRight, anBottom];
+
+ grdMain := TfpgGrid.Create(self);
+ grdMain.Top := 10;
+ grdMain.Left := 10;
+ grdMain.Width := Width - 20;
+ grdMain.Height := 300;
+ grdMain.Anchors := [anLeft, anTop, anRight, anBottom];
+ grdMain.RowCount := 25;
+ for c := 1 to grdMain.ColumnCount do
+ grdMain.Columns[c-1].Title := 'Title ' + IntToStr(c);
+
+ chkShowHeader := CreateCheckBox(self, 10, 320, 'Show Header');
+ chkShowHeader.Checked := True;
+ chkShowHeader.OnChange := @chkShowHeaderChange;
+ chkShowHeader.Anchors := [anLeft, anBottom];
+
+ chkShowGrid := CreateCheckBox(self, chkShowHeader.Right+10, 320, 'Show Grid');
+ chkShowGrid.Checked := True;
+ chkShowGrid.OnChange := @chkShowGridChange;
+ chkShowGrid.Anchors := [anLeft, anBottom];
+
+ chkRowSelect := CreateCheckBox(self, chkShowGrid.Right+10, 320, 'Row Select');
+ chkRowSelect.Checked := False;
+ chkRowSelect.OnChange := @chkRowSelectChange;
+ chkRowSelect.Anchors := [anLeft, anBottom];
+
+ chkDisabled := CreateCheckBox(self, chkRowSelect.Right+10, 320, 'Disabled');
+ chkDisabled.Checked := False;
+ chkDisabled.OnChange := @chkDisabledChange;
+ chkDisabled.Anchors := [anLeft, anBottom];
+end;
+
+
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+ frm := TMainForm.Create(nil);
+ frm.Show;
+ fpgApplication.Run;
+end;
+
+begin
+ MainProc;
+end.
+
|