Toni ha scritto:
> Hi,
>
> I am new to Gambas and I don't know how to solve a problem regarding 
> setting events for new objects.
> I am creating a dynamic menu, but I don't know how to assign an event 
> handler to it.
> Here 2 examples of what I've tried without succes:
>
> Not working 1:
> [...]
> DIM mnu AS Menu
> mnu = NEW Menu(PopUPTray)
> mnu.Name = "a"
>
> PUBLIC SUB a_Click()
>   Message("You clicked on 'a'")
> END
>   
Correct is:

    mnu = new menu(blablah) AS "menua"

  public sub menua_click()
    ....
  end


The only situation where the event handler name has something to do with 
object name is when you use the GUI designer: if you put a Button1 on 
the form, the event handler name will be Button1_click(). In all the 
other cases (ie, when instantiating from code), you must use the AS 
"xxx" syntax.

Regards,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to