summaryrefslogtreecommitdiff
path: root/examples/gui
diff options
context:
space:
mode:
authorAndrew Haines <andrewd207@aol.com>2010-11-10 00:01:53 -0500
committerAndrew Haines <andrewd207@aol.com>2010-11-10 00:01:53 -0500
commit82de8fa58c63d66048afa55ff9c8742900ac0cde (patch)
tree22d6dbab20cc4cf96f4b9a99efc87c838456b8cf /examples/gui
parent261d352b1d02c4945d7228d8f8b478b2547d94ff (diff)
downloadfpGUI-82de8fa58c63d66048afa55ff9c8742900ac0cde.tar.xz
Started implementing Icons in listview
Fixed a crash in the listview example when it was closing Updated listview example to use icons
Diffstat (limited to 'examples/gui')
-rw-r--r--examples/gui/listviewtest/listviewtest.lpr32
1 files changed, 31 insertions, 1 deletions
diff --git a/examples/gui/listviewtest/listviewtest.lpr b/examples/gui/listviewtest/listviewtest.lpr
index afb1fbdf..e97b86bd 100644
--- a/examples/gui/listviewtest/listviewtest.lpr
+++ b/examples/gui/listviewtest/listviewtest.lpr
@@ -4,7 +4,7 @@ program listviewtest;
uses
Classes, sysutils,
- fpg_base, fpg_main, fpg_listview, fpg_form, fpg_button, fpg_edit, fpg_checkbox, fpg_splitter, fpg_panel;
+ fpg_base, fpg_main, fpg_listview, fpg_form, fpg_button, fpg_edit, fpg_checkbox, fpg_splitter, fpg_panel, fpg_imagelist;
type
@@ -30,6 +30,7 @@ type
{ TMainForm }
+
procedure TMainForm.CloseBttn(Sender: TObject);
begin
Close;
@@ -81,12 +82,39 @@ var
LVColumn: TfpgLVColumn;
TopPanel,
BottomPanel: TfpgPanel;
+ IL: TStringList;
+ i: Integer;
+ FImageList: TfpgImageList;
+ FSelectedImageList: TfpgImageList;
+ TmpImage: TfpgImage;
begin
inherited Create(AOwner);
WindowTitle := 'ListView Test';
SetPosition(200, 200, 640, 480);
+ IL := TStringList.Create;
+
+ fpgImages.ListImages(IL);
+
+ FImageList := TfpgImageList.Create;
+ FSelectedImageList := TfpgImageList.Create;
+
+ for i := 0 to IL.Count-1 do
+ FImageList.AddImage(fpgImages.GetImage(IL.Strings[i]));
+
+ IL.Free;
+
+ // invert the items for the 'selected' images
+ FImageList.Item[i].Image.ImageFromSource;
+
+ for i := 0 to FImageList.Count-1 do
+ begin
+ TmpImage := FImageList.Item[i].Image.ImageFromSource;
+ TmpImage.Invert;
+ FSelectedImageList.AddImage(TmpImage);
+
+ end;
BottomPanel := TfpgPanel.Create(Self);
BottomPanel.Align := alBottom;
@@ -108,6 +136,8 @@ begin
OnPaintItem := @PaintItem;
OnSelectionChanged := @ItemSelectionChanged;
MultiSelect := True;
+ Images := FImageList;
+ ImagesSelected := FSelectedImageList;
end;
FSplitter := TfpgSplitter.Create(TopPanel);