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

Dimitris Anogiatis dosida at ...626...
Thu Jul 23 05:50:50 CEST 2009


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,

Regards,
Dimitris

On Wed, Jul 22, 2009 at 6:34 PM, Jean-Yves F. Barbier <12ukwn at ...626...>wrote:

> Hi,
>
> I'd like to use the Key part of a ListView as the name of the proc to call
> when the corresponding item is clicked, is it possible?
>
> JY
> --
> If you tell the truth you don't have to remember anything.
>                -- Mark Twain
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list