[Gambas-user] use a string to make a call

Jean-Yves F. Barbier 12ukwn at ...626...
Thu Jul 23 06:09:34 CEST 2009


Dimitris Anogiatis a écrit :
> JY, I don't know if there's a direct way but this workaround has worked for
> me in the past
> 
> PUBLIC SUB Form_Open()
>     'populate the listview as an example.
>     Listview1.Add("Blah","Hi there")
>     Listview1.Add("Blah2","How are you")
> END
> 
> PUBLIC SUB chooseSub(choice as String)
> 
>     SELECT CASE choice
>        CASE "Blah"
>                Message.Info("Key is Blah")
>        CASE "Blah2"
>                Message.Info("Key is Blah2")
>        CASE ELSE
>     END SELECT
> 
> END
> 
> PUBLIC SUB ListView1_Click()
>     'give the key of the selected item as a parameter
>     'to the chooseSub subroutine
>     chooseSub(Listview1.Item.Key)
> END
> 
> Hope I helped,

YES Dimitri: that's exactly what I wanted
Thanks!

JY
-- 
You can't underestimate the power of fear.
		-- Tricia Nixon




More information about the User mailing list