[lazarus] CheckListBox can't store objects with items in win32 interface
Marc Weustink
marc at dommelstein.net
Sun Dec 7 18:19:04 EST 2003
At 22:23 7-12-2003, Vincent Snijders wrote:
>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?
No, I was just wondering why the checked state was stored as data. The only
thing I could think of was that it wasn't stored (or isn't accessible)
through the interface. So if there is a function like LCLIsItemChecked, I
see no reason to store it in the LCL as well. (Ehm, I don't know if there
is a function like that, I've no access to all source at the moment)
Marc
More information about the Lazarus
mailing list