nrico
asked on
ListView checkboxes!!??
Why is it that when I add an item to a TListView with checkboxes, all items become unchecked?
And how can I remedy this? (I am using D4)
I have found a work-around myself, but it's kind of complicated, I am looking for a simple solution.
And how can I remedy this? (I am using D4)
I have found a work-around myself, but it's kind of complicated, I am looking for a simple solution.
I don't have that problem. The boxes remain checked. I wonder how you add a new item.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi epsylon i presume you have updates applied? i also do and dont get this error either ..
VAR
CheckState : TStringList;
iCount : LONGINT;
BEGIN
CheckState := TStringList.Create;
FOR iCount := 0 TO (ListBox1.Items.Count - 1)
DO
IF ListBox1.Checked[iCount]
THEN
CheckState.Add('1')
ELSE
CheckState.Add('0');
//Add your new item
FOR iCount := 0 TO (CheckState.Items.Count - 1)
DO
ListBox1.Checked[iCount] := (CheckState[iCount] = '1');
CheckState.Free;
END;
It's not ideal and I don't know why Delphi is being a pain but it'll fix your problem
The Neil