summaryrefslogtreecommitdiff
path: root/examples/gui/combobox
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-06-03 10:50:49 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-06-03 10:50:49 +0000
commit4d3dbec5a9fdaa97792c107073083e7489ea605e (patch)
treecdd46c4a8028e9c22552999f429394e8af7734dc /examples/gui/combobox
parent8a3b02508005b580613b95f0e02811a4392a2fc2 (diff)
downloadfpGUI-4d3dbec5a9fdaa97792c107073083e7489ea605e.tar.xz
* Added a RandomData unit to the examples/gui directory.
* Updated the ComboBox demo to use the RandomData unit.
Diffstat (limited to 'examples/gui/combobox')
-rw-r--r--examples/gui/combobox/comboboxtest.lpi10
-rw-r--r--examples/gui/combobox/comboboxtest.lpr2
-rw-r--r--examples/gui/combobox/extrafpc.cfg2
-rw-r--r--examples/gui/combobox/frm_main.pas33
4 files changed, 39 insertions, 8 deletions
diff --git a/examples/gui/combobox/comboboxtest.lpi b/examples/gui/combobox/comboboxtest.lpi
index 41183e45..c950242d 100644
--- a/examples/gui/combobox/comboboxtest.lpi
+++ b/examples/gui/combobox/comboboxtest.lpi
@@ -32,7 +32,7 @@
<PackageName Value="fpgui_package"/>
</Item1>
</RequiredPackages>
- <Units Count="2">
+ <Units Count="3">
<Unit0>
<Filename Value="comboboxtest.lpr"/>
<IsPartOfProject Value="True"/>
@@ -43,10 +43,18 @@
<IsPartOfProject Value="True"/>
<UnitName Value="frm_main"/>
</Unit1>
+ <Unit2>
+ <Filename Value="../common/randomdata.pas"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="RandomData"/>
+ </Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
+ <SearchPaths>
+ <OtherUnitFiles Value="/home/graemeg/programming/fpgui.wc/examples/gui/common/"/>
+ </SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
diff --git a/examples/gui/combobox/comboboxtest.lpr b/examples/gui/combobox/comboboxtest.lpr
index a3a38da1..313a9c0f 100644
--- a/examples/gui/combobox/comboboxtest.lpr
+++ b/examples/gui/combobox/comboboxtest.lpr
@@ -6,7 +6,7 @@ uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
- Classes, fpgfx, frm_main;
+ Classes, fpgfx, frm_main, RandomData;
procedure MainProc;
var
diff --git a/examples/gui/combobox/extrafpc.cfg b/examples/gui/combobox/extrafpc.cfg
index 073dc4b6..a68a9d08 100644
--- a/examples/gui/combobox/extrafpc.cfg
+++ b/examples/gui/combobox/extrafpc.cfg
@@ -1,5 +1,5 @@
-FUunits
--Fu../../../lib
+-Fu../../../lib;../common
-Xs
-XX
-CX
diff --git a/examples/gui/combobox/frm_main.pas b/examples/gui/combobox/frm_main.pas
index 2b834b51..b0be0713 100644
--- a/examples/gui/combobox/frm_main.pas
+++ b/examples/gui/combobox/frm_main.pas
@@ -39,13 +39,17 @@ type
lblName4: TfpgLabel;
cbAllowNew: TfpgComboBox;
{@VFD_HEAD_END: MainForm}
- procedure AfterCreate; override;
+ constructor Create(AOwner: TComponent); override;
+ procedure AfterCreate; override;
end;
{@VFD_NEWFORM_DECL}
implementation
+uses
+ RandomData;
+
{@VFD_NEWFORM_IMPL}
procedure TMainForm.cbAutoCompleteChanged(Sender: TObject);
@@ -69,9 +73,16 @@ begin
end;
procedure TMainForm.btnAdd1Clicked(Sender: TObject);
+var
+ Gender: TGender;
+ n: string;
begin
- Combo1.Items.Add(Format('Item %2d', [Combo1.Items.Count]));
- EditCombo1.Items.Add(Format('Item %2d', [EditCombo1.Items.Count]));
+ Gender := TGender(Random(2));
+ n := RandomFullName(Gender);
+ Combo1.Items.Add(n);
+ EditCombo1.Items.Add(n);
+ Combo1.Items.Sort;
+ EditCombo1.Items.Sort;
end;
procedure TMainForm.btnFocusClicked(Sender: TObject);
@@ -91,12 +102,24 @@ end;
procedure TMainForm.btnAdd10Clicked(Sender: TObject);
var
i: integer;
+ Gender: TGender;
+ n: string;
begin
for i := 1 to 10 do
begin
- Combo1.Items.Add(Format('Item %2d', [Combo1.Items.Count]));
- EditCombo1.Items.Add(Format('Item %2d', [EditCombo1.Items.Count]));
+ Gender := TGender(Random(2));
+ n := RandomFullName(Gender);
+ Combo1.Items.Add(n);
+ EditCombo1.Items.Add(n);
end;
+ Combo1.Items.Sort;
+ EditCombo1.Items.Sort;
+end;
+
+constructor TMainForm.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ Randomize;
end;
procedure TMainForm.AfterCreate;