[lazarus] CheckListBox can't store objects with items in win32interface

Vincent Snijders vslist at zonnet.nl
Sun Dec 7 16:11:17 EST 2003


On Sun, 07 Dec 2003 18:41:49 +0100
Marc Weustink <marc at dommelstein.net> wrote:

> At 10:47 7-12-2003, Vincent Snijders wrote:
> >Hi,
> >
> >While trying to get the debug options dialog working, I noticed that
> >the win32 interface doesn't store the objects associated with a list
> >item in a CheckedListBox (or ListBox).
> >
> >While implementing this the obvious way with LB_SETITEMDATA. This
> >works for TListBox, but not for TCheckListBox, because TCheckListBox
> >stores it Checked property in the item data.
> 
> Yep.
> 
> >Any suggestions to solve this? Storing a heap-allocated record with
> >object and selected fields in the item data is one possibility, but I
> >fear the bookkeeping involved. Any suggestions are wellcome.
> 
> I had the samme problem when I introduced the CheckList. Delphi uses
> the TCheckListBoxDataWrapper class to handle this. We can do it the
> same way, but like you said, you need some bookkeeping.
> Another way is to move the checkstate to the interface, so that
> Item.Dat is just userdata. The TCheckListBoxDataWrapper class isn't
> published, so I have no problems with that.
> 
> Marc
Maybe I don't understand you, but at the moment checkstate is stored in
the interface, together with item text and item object. So where do you
want to move the checkstate to? 
Do you mean to move the storage of checked state to the LCL?

Regards,
Vincent.






More information about the Lazarus mailing list