[Gambas-devel] gb3 menus and the item that was clicked
Kadaitcha Man
nospam.nospam.nospam at ...176...
Thu Dec 31 02:27:01 CET 2009
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.
More information about the Devel
mailing list