[Gambas-user] extended Combobox

B Bruen bbruen at ...2308...
Mon May 26 12:36:00 CEST 2014


On Mon, 26 May 2014 11:50:16 +0200
Benoît Minisini <gambas at ...1...> wrote:

> Le 25/05/2014 23:48, Christof Thalhofer a écrit :
> > Hi,
> >
> > Am 25.05.2014 21:12, schrieb Karl Reinl:
> >
> >> I need an extended Combobox,
> >> no sorry I would like to have an extended Combobox,
> >> where I can add elements like
> >> .Add(Item AS String[,key AS Variant]),
> >> does anybody made that yet, and want to share ?
> >
> > Funny. I started working with Gambas a week ago and saw, that the
> > existing ComboBox does not match my requirements. So I started to write
> > my own. It's not complete yet, but seems to become quite good and aims
> > to reproduce the behaviour of the MS Access Combobox.
> >
> > One can fill it with the content of a table (rows, columns), decide,
> > which columns are displayed, one column can contain a index which the
> > ComboBox spits out in any way (for example for a db primary key – not
> > ready, and for me that feature is in question for now).
> 
> There is a "DataComboBox" in gb.db.form that does that more or less. But 
> I admit there is no a "ComboBox with a key".
> 
> Maybe I should implement it, as many lazy :-) old VB users ask for that.
> 
> Regards,
> 
> -- 
> Benoît Minisini
> 
OK, I bit.  Karl reminded me of something I have been meaning to do for some time (read, should have done some time ago).

It's not exactly a keyed combo, nor is it exactly what I wanted (read the changelog) but it took about 3 hours.  You can possibly turn it into a keyed combo by using a "Data" class that provides a "display" string property and a variant "index" property.

We needed a combobox (in fact a set of controls) that are "data aware" i.e. since we have created all these objects for example from a database select, all we want to do is get them to display in some user selectable control, when the user makes the selection I dont want to go back and re-read the db as I already have the thing in memory. 

Good/bad design? Who cares! I am talking about small collections of small generally immutable objects here.

Anyway, attached is the custom control as an autotools installable and a test harness as a source archive.

cheers
-- 
B Bruen <bbruen at ...2308...>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: paddys-hill-datacombosimple-0.0.22.tar.gz
Type: application/octet-stream
Size: 71724 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20140526/be11019b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: datacombotest-0.0.1.tar.gz
Type: application/octet-stream
Size: 7012 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20140526/be11019b/attachment-0001.obj>


More information about the User mailing list