[Gambas-devel] gb3 menus and the item that was clicked
Toni
arosa at ...615...
Thu Dec 31 02:44:42 CET 2009
Just out of curiosity I tested what I told you, and it seems to work
properly, at least in gambas 2.
Find my test project attached.
En/na Kadaitcha Man ha escrit:
> 2009/12/31 Toni <arosa at ...615...>:
>
>
>> Hi,
>> Did you try using "LAST" ?
>>
>> E.g. Last.Name would give you the name of the last clicked menu.
>>
>> For instance, if you generate the menus dinamically I guess that you
>> could use the same event firing for all of them (I haven't tested it,
>> but it could go as follows):
>>
>> DIM mnu AS Menu
>> mnu = NEW Menu(rootmenu) AS "MnuHandler"
>> mnu.Name = "mnu1"
>> mnu.Caption = "a"
>> mnu = NEW Menu(rootmenu) AS "MnuHandler"
>> mnu.Name = "mnu2"
>> mnu.Caption = "b"
>>
>> and then
>>
>> PUBLIC SUB MnuHandler_Click()
>> DEBUG Last.Name
>> END
>>
>
> It won't work.
>
> 1) The second mnu = NEW Menu(rootmenu) AS "MnuHandler" will kill the
> event handler of the first instance.
>
> 2) MnuHandler_Click is the event handler for the parent only.
>
> 3) I will need thousands of lines of additional code if I have to
> construct the menu dynamically. I could load an array from data and
> loop through it, but it's a moot idea because of points 1) and 2).
>
> Thanks anyway.
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20091231/2735a215/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_mnu.tar
Type: application/x-tar
Size: 20480 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20091231/2735a215/attachment.tar>
More information about the Devel
mailing list