[Gambas-user] right click menu
fabien Bodard
arcalis.prod at ...11...
Wed Mar 29 21:46:04 CEST 2006
Le Mercredi 29 Mars 2006 14:06, mike webb a écrit :
> in a form i call form1 i have a tableview which i call tableview1, when
> i right click on tableview1 this function fires:
>
> PUBLIC SUB TableView1_Menu()
> mydataview.menu
> END
>
> this calls a class i have created which has the following functions:
>
>
> PUBLIC SUB menu()
> DIM rightmenu AS Menu
> DIM addmenuitem AS Menu
> DIM deletemenuitem AS Menu
> DIM editmenuitem AS Menu
>
> rightmenu = NEW Menu(application.ActiveWindow,FALSE)
> editmenuitem = NEW Menu(rightmenu,FALSE)
> addmenuitem = NEW Menu(rightmenu,FALSE)
> deletemenuitem = NEW Menu(rightmenu,FALSE)
>
> deletemenuitem.Text = "delete a row"
> editmenuitem.Text = "edit a row"
> addmenuitem.Text = "add a row"
>
> rightmenu.Popup
> END
>
> the menu pops up and has "delete a row","edit a row"," add a row" but
> when i select "edit a row" from the menu the sub editmenuitem_click is
> never called.
>
> PUBLIC SUB editmenuitem_click()
> message.Info("add")
> END
>
> anyone see what i'm doing wrong ???
>
Yes me :)
rightmenu = NEW Menu(application.ActiveWindow,FALSE)
editmenuitem = NEW Menu(rightmenu,FALSE) AS "EditMenuItem"
addmenuitem = NEW Menu(rightmenu,FALSE) AS "AddMenuItem"
deletemenuitem = NEW Menu(rightmenu,FALSE) AS "DeleteMenuItem"
it will work.
You need to define the events handler by hand when a control is dynamiquely
created
Regards,
Fabien Bodard
More information about the User
mailing list