[Gambas-user] dynamic popup menu, right click
Benoit Minisini
gambas at ...1...
Thu Mar 30 23:36:10 CEST 2006
On Thursday 30 March 2006 14:35, mike webb wrote:
> boy i sure understand that i
>
> must assign an event name to your newly created controls
> i'm trying that with the sub
>
> PUBLIC SUB editmenuitem_click()
> message.Info("edit was selected")
> END
>
>
> this sub is for the newly created control
>
> PUBLIC editmenuitem AS Menu
>
> notice how i've placed the _click after the control name.
> is that not correct ??
>
> the email that you replied with does not have this sub in it, look a the
> original that i sent, it should be their.
>
> Benoit Minisini wrote:
> >On Thursday 30 March 2006 08:54, mike webb wrote:
> >>still havn't figured out this problem, tried reducing the problem by
> >>simplifing some stuff but it still doesnt work:
> >>what i'm trying to do is catch the "click" event from a dynamicly
> >>created "right click" popup menu.
> >>in form1 i have these public variables:
> >>PUBLIC rightmenu AS Menu
> >>PUBLIC addmenuitem AS Menu
> >>PUBLIC deletemenuitem AS Menu
> >>PUBLIC editmenuitem AS Menu
> >>
> >>in form1 i have created a tableview called tableview1, and this sub:
> >>PUBLIC SUB TableView1_Menu()
> >> rightmenu = NEW Menu(form1,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
> >
> >You must assign an event name to your newly created controls, as Fabien
> > told you. Otherwise your menu won't raise any event!
> >
> >Regards,
Read the mail of Fabien Bodard carefully again:
editmenuitem = NEW Menu(rightmenu,FALSE) AS "EditMenuItem"
addmenuitem = NEW Menu(rightmenu,FALSE) AS "AddMenuItem"
deletemenuitem = NEW Menu(rightmenu,FALSE) AS "DeleteMenuItem"
Do you notice the AS "xxx" after the NEW? That defines the event name of the
object, and allows it to raise events.
Regards,
--
Benoit Minisini
More information about the User
mailing list