In article <a84984760910192126q35e9eec0m8f3e219554033...@mail.gmail.com>, John Labenski <jlaben...@gmail.com> wrote: > On Mon, Oct 19, 2009 at 4:40 AM, Michael Gerbracht <smartma...@arcor.de> > wrote: > > I am new to wxLua and would like to know how to add a context menu to a > > winodw (I know how to create a menu bar). The window is a TreeCtrl pane > > of a AUI frame if this makes anydifference.
> You want to create a wxMenu and call wxWindow::PopupMenu() in your event > function connected to a wxWindow using the wxEVT_LEFT_UP event type and you > will get a wxMouseEvent. > Hope this helps, John Yes, thank you very much, I got it to work now. I have a follow up question now: I would like to use the same menu on different TreeCtrl panes so I need a way to find out on which of the windows the mouse button was pressed. AFAIK the object is stored in the event. If I use: print(tostring(event:GetEventObject())) I get the output: userdata: 03377B60 [wxObject(03477F0, 69)] If I compare this to the window: print(tostring(windowID)) I get the output: userdata 0340B8D0 [wxTreeCtrl(034A77F0, 354)] I see that "034A77F0" appears in both cases but I do not know how to extract it from the userdata[1]. Alternatively it would also be ok to read out the name of the TreeCtrl I gave it upon creation, it is unique but I do not know how to read it out. Thanks again, Michael [1] of course one could use string.find but I guess there is a more elegant way of doing that. ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users