From: John L. <jla...@gm...> - 2005-06-26 23:41:13
|
On 6/26/05, The Doctor <the...@bl...> wrote: > I've just seen my first wxLua crash. >=20 > WXLUA caused a stack fault in module WXMSW254_VC_WXLUA.DLL at 016f:100d10= eb. Oops. :( > It happens consistently, as a result of using X:SetEventHandler(PANEL), w= here X is a button or other control whose event handling is set elsewhere f= or common handling of mouse clicks. The program is running ok as far as I k= now, until the crash is invoked by changing the OS colour scheme. (I discov= ered this while changing it to see the effects of using wx.wxNullColour.) I= commented out all the new code to eliminate things until the bug didn't ha= ppen, then looked at what addition would alone be enough to cause the crash= when the OS scheme was changed, and it's definitely that X:SetEventHandler= (PANEL) bit. Even with NO code affecting colours by explicit demand, this h= appens. I don't think your SetEventHandler(otherWindow) trick will work without some serious c++ testing.You're probably breaking the chain of handlers, hence the segfault. However, you may want to explore PushEventHandler, but I bet you have to Pop it before the window is destroyed. What you're doing sounds a little strange, it doesn't make sense to get the left button press on a wxButton, just get the wx.wxEVT_COMMAND_BUTTON_CLICKED or if you want to disable the button use button:Enable(false). Remember, wxWidgets wraps around the native library and if that doesn't provide a function, neither does wxWidgets (but they do try to smooth things out as much as possible). I would be pleasantly surprised if a wxButton emitted a left down event for example. In terms of double clicks, it's always down, up, double IIRC. Finally, FRAME:GetEventHandler():ProcessEvent(event) merely takes the event you get in a child window, so you've got to set a handler for it, and then asks the FRAME to handle it as if it was meant for it (you're on your own doing this for key and mouse events since wxWidgets may use them as well for some controls and won't expect them from child windows). It would be best to simply call a common function to handle the event for all windows if this is what you really want. Good luck, John Labenski |