From: The D. <the...@bl...> - 2005-06-26 18:16:30
|
Here's an example. It will exit if the panel is double-clicked because wxEVT_LEFT_UP is explicitly linked to the panel, but the notebook isn't clickable, nor would any control on it be clickable unless it has its own explicit handling code. All I want is for wxEVT_LEFT_UP to be handled wherever it appears, and for my function to filter the event according to the ID of the control that produced the event. I've tested stuff to confirm that the ID is indeed passed, so this ought to work, and to be ideal. If it wasn't impossible... If any toolbar button or menu entry works with wxEVT_COMMAND_MENU_SELECTED, and any button works with wxEVT_COMMAND_BUTTON_CLICKED, surely it makes sense to have any double-click of the left mouse button work with wxEVT_LEFT_DCLICK regardless of where in the area of a frame or dialog it happens. Separating the events by ID filtering is easy, so this would be the right way, given that it's fine for most other controls events. It might be arguable that there could be too many things to filter from, but I can't imagine why, there are only so many clicks per second the average human finger can do. :) --======================================================= FRAME=wx.wxFrame(wx.wxNull,-1,TITLE,wx.wxDefaultPosition,wx.wxSize(436,314)) PANEL=wx.wxPanel(FRAME,-1) PAGES=wx.wxNotebook( PANEL, -1, wx.wxPoint(11,30), wx.wxSize(405,230), wx.wxNB_TOP ) PANEL:ConnectEvent(-1,wx.wxEVT_LEFT_UP, function(event) FRAME:Destroy() end ) FRAME:Centre() FRAME:Show(wx.TRUE) --======================================================= |