Combobox

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
andrebit
Posts: 16
Joined: Sat Jun 13, 2009 2:18 pm

Combobox

Post by andrebit »

Hi Friends

Happy 2010!

About combobox, is there a way to Value property get a custom value when we use an array as Items property (instead the normal behavior, ie, Value ger the number of row selected )? Like when Itemsource/Valuesource is used?

My idea is to have another array with values to put into Value property when one item is choose. As if was possible to pass an array to Valuesource.

Something like this:

Define COMBOBOX cbTest;
ITEMS {'Orange','Peach','Apple','Blackberry'};
VALUESOURCE {'14564','23456','87654','76543','14567'}

I was clear??? sorry my awfull english.

Thanks

André


p.s. HMG RULES!
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Combobox

Post by Rathinagiri »

Does it mean that, if I select Blackberry, the value returned would be 14567?

Even now we can do that using a small work around. Isn't it?

Code: Select all

function definecombo
private aValues := {14564,23456,87654,76543,14567}

define window window1

define combobox cbTest
   ....
   items {'Orange','Peach','Apple','Blackberry'};
end combobox
end window
activate window...
return nil


function findcomboboxvalue
msginfo(str(aValues[window1.cbTest.value]))
return nil

East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
andrebit
Posts: 16
Joined: Sat Jun 13, 2009 2:18 pm

Re: Combobox

Post by andrebit »

Exactly Rathinagiri. I use array in combos that way you show, but i think it will be very nice if its possible to put the "return values array" as a property of control. What do you think about? Its worth to add it to HMG wishlist?

regards

André
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Combobox

Post by Rathinagiri »

I don't know about the internals and memory leakage because of this implementation. May be Roberto is the right person.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: Combobox

Post by Roberto Lopez »

andrebit wrote:Hi Friends

Happy 2010!

About combobox, is there a way to Value property get a custom value when we use an array as Items property (instead the normal behavior, ie, Value ger the number of row selected )? Like when Itemsource/Valuesource is used?

My idea is to have another array with values to put into Value property when one item is choose. As if was possible to pass an array to Valuesource.
This is not possible right now, but is a nice feature to add in future versions. I've added to my TODO list.

Meanwhile, you could do something like this:

Code: Select all


aReturenValues := { 'One' , 'Two' , 'Three' }

<...>

MyValue := aReturnValues [ Win1.Combo1.Value ]

Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply