[Gambas-user] dynamic popup menu, right click

mike webb mwebb at ...1362...
Fri Mar 31 08:57:19 CEST 2006


Benoit Minisini wrote:

>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,
>
>  
>

Read the mail of Fabien Bodard carefully again:

 editmenuitem = NEW Menu(rightmenu,FALSE) AS "EditMenuItem"

yes you are correct, i looked right at it and still didn't see it.
discovered this for myself last night while i was going over the IDE 
source code.
theirs A LOT of things that can be learned by reading that source code.
i believe i'm going to be doing a lot of source code reading over the 
next few weeks.
btw thanks everyone for helping.

upgrading to fedora core 5 today, afterwards i hope to be able to 
compile the lastest dev. version of gambas.
(then i'll be able to give you guys reallllly big headaches)






More information about the User mailing list