[Gambas-user] right click menu

mike webb mwebb at ...1362...
Wed Mar 29 16:31:30 CEST 2006


fabien Bodard wrote:

>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
>
>i thought i did when i created the sub:
>
>PUBLIC SUB editmenuitem_click()
>  message.Info("add")
>END
>  
>
isn't that how you create a event handler ??

>-------------------------------------------------------
>This SF.Net email is sponsored by xPML, a groundbreaking scripting language
>that extends applications into web and mobile media. Attend the live webcast
>and join the prime developer group breaking into this new coding territory!
>http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
>_______________________________________________
>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