On 25.11.2013 at 05:17 John Labenski wrote:


> On Sun, Nov 24, 2013 at 5:13 AM, Andreas Falkenhahn <andr...@falkenhahn.com> 
> wrote:
>  
> Hi John,
>  

>  
 >>> I'm trying to port some C++ code to wxLua that derives a new class from
 >>> wxTextCtrl and then overrides the OnRightClick() method of this class
 >>> to do some custom stuff when the user presses RMB over the widget.
 >>  Catch EVT_RIGHT_UP and call event.Skip() for normal processing.
 >> Calling virtual functions like this is discouraged and may not
 >> continue to work in the future for all platforms.
>  
>  Tried it like this but it doesn't work:
>  
>  frame:Connect(100, wx.wxEVT_RIGHT_UP, function(e) print("hello") end)
>  
>  




> What is supposed to happen? wxWidgets 2.8 and 3.0 don't seem to
> have a OnRightClick() function at all.

Right, sorry, I've overlooked the fact that the code I'm trying to port
to wxLua doesn't actually override OnRightClick() but connects an event
handler to EVT_RIGHT_UP like this:

BEGIN_EVENT_TABLE(WidgetsTextCtrl, wxTextCtrl)
    EVT_RIGHT_UP(WidgetsTextCtrl::OnRightClick)
END_EVENT_TABLE()

So the code in wxLua has to look like this:

textCtrl:Connect(wx.wxEVT_RIGHT_UP, function(e) print("hello") end)

Then it works fine.

-- 
Best regards,
 Andreas Falkenhahn                            mailto:andr...@falkenhahn.com


------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to