Re: GenButton and acceleratorTable
Robin Dunn <[email protected]> Tue, 18 Dec 2018 16:06:54 -0800 (PST)
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
TBH, it surprises me a little that it works with wx.Button. What platform are you working on? Where is the keyboard focus at the time the keys are pressed? Do you have EVT_MENU or EVT_TOOL event bindings for those button IDs or is the accelerator activating the button and sending an EVT_BUTTON? The accelerator table is designed to be a different way to trigger menu events, so if you don't already have EVT_MENU bindings that would be the thing to try. Just have them call the same handler already bound to the EVT_BUTTON events. -- Robin On Sunday, December 16, 2018 at 9:53:43 AM UTC-8, Nicolas Pinault wrote: > > Hi, > > Using WxPython 4.x : > > With the following code, accelerators work correctly : > > self.button_p = wx.Button(self.toolbar, wx.ID_ANY, size=(32, 32)) > self.button_n = wx.Button(self.toolbar, wx.ID_ANY, size=(32, 32)) > > > accelerator_table = wx.AcceleratorTable([(wx.ACCEL_NORMAL, > wx.WXK_LEFT, self.button_p.GetId()), > (wx.ACCEL_NORMAL, wx.WXK_RIGHT, self.button_n.GetId())]) > self.SetAcceleratorTable(accelerator_table) > > When replacing wx.Button() with wx.lib.buttons.GenButton(), accelerators > do not work anymore. > I need owner drawn buttons, hence the use of GenButton(). > > How can I fix this issue ? > > Best regards, > Nicolas > -- You received this message because you are subscribed to the Google Groups "wxPython-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.