From: Andreas F. <an...@fa...> - 2013-11-24 10:12:16
|
Hi John, On 24.11.2013 at 06:44 John Labenski wrote: > On Nov 23, 2013 4:30 PM, "Andreas Falkenhahn" <an...@fa...> wrote: >> Hi, >> 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) (100 is the ID of the wxTextCtrl) >> Is it possible to do this in wxLua as well? I tried the following but >> it didn't work: >> local ctrl = wx.wxTextCtrl(...) >> ctrl.OnRightClick = function(event) print("test") end > C++ requires you to subclass and override all virtual functions. > The speed/size overhead to do this for all classes/functions would > be enormous so wxLua only does this where absolutely necessary. > John Ok, makes sense. -- Best regards, Andreas Falkenhahn mailto:an...@fa... |