Hi,
?
I implemented TComboBoxEx and TCheckComboBox.
The first is combo with images. This control is in Delphi7 too. My implementation has one difference - it is readonly, because I needed csOwnerDrawFixed for painting. The second is combo with checkboxes. Internally it uses Items.Objects[] for storing State and ItemEnabled. Some known issues are described in README.txt which is attached in archive.? Package in comboex.zip is now available here: http://bugs.freepascal.org/view.php?id=26515#bugnotes? ?
So it's up to Lazarus managers to decide whether the components will be part of Lazarus or if I should make them in separate package or part of my EC-Controls. ?
I tested them in GTK2/Qt4 and Wine, so some test in Carbon is welcome. ?
Thanks.
?
Vojt?ch?
?
Mailing lists / lazarus / 2014-09
TComboBoxEx and TCheckComboBox
6 messages · 2 people ·
- VVojtěch Čihák 4
- MMattias Gaertner 2
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi, ? I implemented TComboBoxEx and TCheckComboBox. The first is combo with images. This control is in Delphi7 too.
Great!
My implementation has one difference - it is readonly, because I needed csOwnerDrawFixed for painting. 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.
Show quoted text 6 lines
Thanks for contributing.
Mattias
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. ______________________________________________________________
Show quoted text 5 lines
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.
Show quoted text 5 lines
This is possible, but it would be inconsistent to the other LCL controls.
For example:
Items is a TStrings, so it would be nice if
ComboEx.Items.Assign(MyStrings) and MyStrings.Assign(ComboEx.Items) works normally.
It would be nice if the Enabled states are stored outside Items.
Mattias
MyStrings.Assign(ComboEx.Items) ?//this should work normally ?
ComboEx.Items.Assign(MyStrings) ?//this is possible via ComboEx.AssignItems(MyStrings)? ?
There are inconsistency but I see now way how ?to avoid it. ?
For example, the?ComboEx.Items.Assign(). Here I would need some notification that new data was assigned - to clear old?TCheckComboItemStates and create new one for each new string in list. But there is no such notification. I tried to create new class derived from TStringList but it lead to other problems. Class helper and FPONotifyObserver was also a blind way. ?
Vojt?ch?
?
Show quoted text 5 lines
This is possible, but it would be inconsistent to the other LCL controls.
For example:
Items is a TStrings, so it would be nice if
ComboEx.Items.Assign(MyStrings) and MyStrings.Assign(ComboEx.Items) works normally.
It would be nice if the Enabled states are stored outside Items.
Mattias
I wasn't clear. What I was talking about was TCheckComboBox. ?
TComboBoxEx has property ItemsEx which is TCollection descendant. Property Items is covered there. I used the same what Delphi do.?
