[Gambas-user] Building a custom MyComboBox

Matti matti.eber at ...3240...
Mon Mar 3 21:09:51 CET 2014


Thanks, Tobi. Sounds plausible, I'll try that.
Of course, I'm trying to write this in Gambas - I don't know any other language except VB, but that was long ago...

Am 03.03.2014 20:55, schrieb Tobias Boege:
> On Mon, 03 Mar 2014, Matti wrote:
>> I'm playing around with a ComboBox that should have some special features.
>> Looked into the sources and found out how to create and inherit it.
>> Subs, Functions and Events  work.
>>
>> But one thing is a complete riddle to me:
>> In the wiki, it says: "For example, you can create a custom MyListBox class that inherits ListBox <http://gambasdoc.org/help/comp/gb.qt/listbox?view> but allows to associate a tag with each list item."
>> That's exactly what I'd need for MyComboBox: each list item with a tag (ID from a database).
>>
>> Could someone give me a hint how to do that?
>> Thanks, Matti
>>
> You could have a
>
> Private $aTags As New Variant[]
>
> in your class which associates a Variant with an item via the item's index.
> You need to maintain that array, though. Watch out for the Add(), Clear()
> and Remove() methods and the List property! I'm not familiar with the
> sources, so I don't know if there is a smarter way (and I'm assuming that
> you write the extended ComboBox in Gambas).
>
> Regards,
> Tobi
>





More information about the User mailing list