From: Andreas F. <an...@fa...> - 2013-11-25 14:23:34
|
On 25.11.2013 at 05:17 John Labenski wrote: > On Sun, Nov 24, 2013 at 5:13 AM, Andreas Falkenhahn <an...@fa...> 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:an...@fa... |