From: John L. <jla...@gm...> - 2013-11-21 18:39:05
|
On Thu, Nov 21, 2013 at 11:32 AM, Andreas Falkenhahn <an...@fa... > wrote: > Hi, > > in wxWidgets I can do the following: > > BEGIN_EVENT_TABLE(RadioWidgetsPage, WidgetsPage) > EVT_RADIOBOX(RadioPage_Radio, RadioWidgetsPage::OnRadioBox) > EVT_RADIOBOX(wxID_ANY, RadioWidgetsPage::OnRadioBox2) > END_EVENT_TABLE() > > OnRadioBox() should be called when the wxRadioBox that has the id > RadioPage_Radio > is clicked, otherwise OnRadioBox2 should be called. In wxLua this looks > like this: > > I would have assumed that OnRadioBox2 would be called for ALL events of ANY id. > this:Connect(RadioPage_Radio, wx.wxEVT_COMMAND_RADIOBOX_SELECTED, > OnRadioBox) > this:Connect(wx.wxID_ANY, wx.wxEVT_COMMAND_RADIOBOX_SELECTED, OnRadioBox2) > > However, the use of wxID_ANY seems to confuse wxLua here because even if > the > user clicks the wxRadioBox that has the id RadioPage_Radio wxLua will still > run the OnRadioBox2() callback. Is that a bug or some kind of limitation? > > This would be the expected behavior, I think. You are installing TWO callback handlers so both are called if their patterns match. I would guess that the difference is that maybe you are calling event.Skip(true/false) or not at all in the two different programs. Note that not calling event.Skip() is the same as calling event.Skip(false) and that skipping the event means that the event is propagated to the next matching handler (if one exists). For simplicity, if you need the wxID_ANY I would only have that one handler and use a "case" style statement to route the event to any specialized handler. Regards, John |