Ok unless someone has a better idea and I came up with the following method.
Maybe useful to someone one day as having check boxes on a listview is quite
handy.
// loading values into listview and not using images so stateindex holds
keep value
ListItem.Caption := '';
ListItem.Checked := Fieldbyname('Keep').AsBoolean;
ListItem.StateIndex := Integer(Fieldbyname('Keep').AsBoolean);
// In the change event that gets fired by checking a box
procedure TfrmGuests.lvClientChange(Sender: TObject; Item: TListItem;
Change: TItemChange);
begin
if FLoading = False then
if Item.Checked <> Boolean(Item.StateIndex) then // checkbox state
changed
begin
Item.StateIndex := Integer(Item.Checked);
// post change to DB here as we know which item has changed
end;
end;
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Alan Rose
Sent: Friday, May 25, 2001 9:31 AM
To: Multiple recipients of list delphi
Subject: [DUG]: Checkboxs in TListview
Hi I am using checkboxes in a TListview for the first time and surprised
there appears no obvious way to capture a checkbox being ticked or unticked.
Unlike the TCheckListbox that does have an event for this purpose. Also
ticking a checkbox does not appear to make the item selected in the list.
I'd like to be able to post an update immediately to the Db for the record
checked. Has anyone done this before with checkboxs in a listview?
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"