1 { KOL MCK } // Do not remove this line!
8 uses Windows
, Messages
, ShellAPI
, KOL
{$IFNDEF KOL_MCK}, mirror
, Classes
,
9 mckCtrls
, Controls
, mckObjs
{$ENDIF};
12 Windows
, Messages
, SysUtils
, Classes
, Graphics
, Controls
, Forms
, Dialogs
;
17 {$I MCKfakeClasses.inc}
24 KOLProject1
: TKOLProject
;
26 ListView1
: TKOLListView
;
27 ImageList1
: TKOLImageList
;
31 procedure KOLForm1FormCreate(Sender
: PObj
);
32 procedure Button1Click(Sender
: PObj
);
33 procedure ListView1MouseDown(Sender
: PControl
;
34 var Mouse
: TMouseEventData
);
35 procedure ListView1KeyDown(Sender
: PControl
; var Key
: Integer;
37 procedure Timer1Timer(Sender
: PObj
);
39 { Private declarations }
41 { Public declarations }
48 Form1
{$IFDEF KOL_MCK} : PForm1
{$ELSE} : TForm1
{$ENDIF} ;
51 procedure NewForm1( var Result
: PForm1
; AParent
: PControl
);
56 //uses ... other user defined uses;
58 {$IFNDEF KOL_MCK} {$R *.DFM} {$ENDIF}
67 procedure TForm1
.KOLForm1FormCreate(Sender
: PObj
);
72 ListView1
.LVColAdd('Colum1', taLeft
, (ListView1
.Width
- 4){ div });
73 //ListView1.LVColAdd('Colum2', taLeft, (ListView1.Width - 4) div 2);
76 //ListView1.LVAdd('111', 0, [], 0, 0, 0);
77 ListView1
.LVItemAdd('Item: '+Int2Str(i
));
82 procedure CheckIcon(LV
: PControl
; Item
: Integer);
84 if LV
.LVItemImageIndex
[Item
]<>1 then
85 LV
.LVItemImageIndex
[Item
]:=1
87 LV
.LVItemImageIndex
[Item
]:=0;
92 procedure TForm1
.ListView1MouseDown(Sender
: PControl
;
93 var Mouse
: TMouseEventData
);
95 TLVHitTestInfo
= packed record
107 ListView1
.Perform(LVM_HITTEST
, 0, Integer(@ HTI
));
108 if LongBool(HTI
.flags
and LVHT_ONITEMICON
) then
109 CheckIcon(ListView1
, HTI
.iItem
);
114 procedure TForm1
.ListView1KeyDown(Sender
: PControl
; var Key
: Integer;
118 if ListView1
.CurIndex
>=0 then
119 CheckIcon(ListView1
, ListView1
.CurIndex
);
124 procedure TForm1
.Button1Click(Sender
: PObj
);
126 if Timer1
.Enabled
then
128 Timer1
.Enabled
:=False;
129 Button1
.Caption
:='Demonstrate';
133 Timer1
.Enabled
:=True;
134 Button1
.Caption
:='Stop';
135 ListView1
.Focused
:=True;
141 procedure TForm1
.Timer1Timer(Sender
: PObj
);
149 if (r
>ListView1
.Count
) or (r
>ListView1
.Count
) then Exit
;
150 if ListView1
.LVItemImageIndex
[r
]=0 then
151 ListView1
.LVItemImageIndex
[r
]:=1
153 ListView1
.LVItemImageIndex
[r
]:=0;
155 ListView1
.LVSetItem(m
, 0, ListView1
.LVItems
[m
, 0], 0 , [lvisSelect
], 0, 0, ListView1
.LVItemData
[m
]);