[Lazarus] TComboBoxEx and TCheckComboBox

Vojtěch Čihák vojtech.cihak at atlas.cz
Wed Sep 10 16:59:10 CEST 2014


Currently, Items.Objects[] is used as a pointer:
 
{ TCheckComboItemState }
 TCheckComboItemState = record
 State: TCheckBoxState;
 Enabled: Boolean;
 end;
 PTCheckComboItemState = ^TCheckComboItemState;  
 
I needed to hook there because the combo can be sorted and Objects are sorted too.
If it is enough, I can extend the record to:
{ TCheckComboItemState }
 TCheckComboItemState = record
State: TCheckBoxState;
Enabled: Boolean;
Data: TObject;
 end;
PTCheckComboItemState = ^TCheckComboItemState;
 
which will allow to users to have associated object but working with Data will be little different
than working with normal Combo.
 
Instead
Items.Objects[i];
it will be
PTCheckComboItemState(Items.Objects[i])^.Data;
 
Although, I can do new property TCheckComboBox.Objects[] and getters + setter will do the job.
______________________________________________________________
> Od: Mattias Gaertner <nc-gaertnma at netcologne.de>
> Komu: <lazarus at lists.lazarus.freepascal.org>
> Datum: 10.09.2014 16:14
> Předmět: Re: [Lazarus] TComboBoxEx and TCheckComboBox
>
On Wed, 10 Sep 2014 15:51:03 +0200
Vojtěch Čihák <vojtech.cihak at atlas.cz> wrote:


> The second is combo with checkboxes. Internally it uses Items.Objects[] for storing State and ItemEnabled.

Can you change that? 
Items.Objects is usually for users custom data.

_______________________________________________
Lazarus mailing list
Lazarus at lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus <http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140910/ada1e481/attachment-0003.html>


More information about the Lazarus mailing list