From: John L. <jla...@gm...> - 2006-05-30 09:13:57
|
On 5/29/06, Steve Kieu <ha...@ya...> wrote: > > OOPS My mistake it should prefixed with wx. > > So most of them works but not wxEVT_LEAVE_WINDOW > > frame=wx.wxFrame(wx.wxNull, 10001, "test") > --frame:ConnectEvent(10001, wx.wxEVT_ENTER_WINDOW, function (event) > print"Enter work" end) > frame:ConnectEvent(10001, wx.wxEVT_LEAVE_WINDOW, function (event) > print"Leave not work" end) --not work > --frame:ConnectEvent(10001, wx.wxEVT_MOTION, function (event) > print"Motion Work" end) > --frame:ConnectEvent(10001, wx.wxEVT_LEFT_DCLICK, function (event) > print"work" end) > --frame:ConnectEvent(10001, wx.wxEVT_LEFT_DOWN, function (event) print"Left > down work" end) > --frame:ConnectEvent(10001, wx.wxEVT_LEFT_UP ,function (event) print"Left up > work" end) > --frame:ConnectEvent(10001, wx.wxEVT_RIGHT_DCLICK ,function (event) > print"Right dclick work" end) > --frame:ConnectEvent(-1, wx.wxEVT_RIGHT_DOWN ,function (event) print"Right > work" end) > --frame:ConnectEvent(-1, wx.wxEVT_RIGHT_UP ,function (event) print"Right up > work" end) > frame:Center() > frame:Show(true) > For the HTMLWIndow I think the COMMAND EVENT works but not for mouse event > which is natural for a button, thus I think it is ok > > Sorry for a big noise. :-) > > ANyway the wx.wxEVT_LEAVE_WINDOW not work which I do not understand yet.. Events like mouse and wxEVT_LEAVE_WINDOW need to be connected directly to the window. The rule is that if the event is not derived from a wxCommandEvent it won't travel up the event handler chain. You can also tell by the event macro signature, for example EVT_LEAVE_WINDOW(func) doesn't take an id. Try: button:Connect[Event](10001, wxEVT_LEAVE_WINDOW, function(event) print("Bye.") end) Or button:Connect[Event](wx.wxID_ANY, wxEVT_LEAVE_WINDOW, function(event) print("Bye.") end) The latter may be required for some reason, that is a wxWidgets issue however. -John Labenski |