wx.EVT_MOUSEWHEEL is not working in wx2.9

hello.

below code is not working in wxPython 2.9 version

        self.Bind(wx.EVT_MOUSEWHEEL, self.moveparentpanel)

    def moveparentpanel(self, event):
        self.GetParent().GetEventHandler().ProcessEvent(event)
        event.Skip()

any idea about this?

Wonjun, Choi

Platform? Does it work in 2.8? What kind of widget is self.GetParent()?

···

On 3/7/12 11:35 PM, Wonjun, Choi wrote:

hello.

below code is not working in wxPython 2.9 version

         self.Bind(wx.EVT_MOUSEWHEEL, self.moveparentpanel)

     def moveparentpanel(self, event):
         self.GetParent().GetEventHandler().ProcessEvent(event)
         event.Skip()

any idea about this?

--
Robin Dunn
Software Craftsman

Platform : ubuntu 11.10 32bit
It’s woking well in 2.8 version
the Parent is wx.Panel and above contontrol is in wx.FlexGridSizer

Wonjun, Choi

and the parent of wx.Panel is wx.Frame. any idea about this?

You answered your own question in your last reply to this thread. Panels don't scroll, so it should not be surprising that they ignore mouse-wheel events.

OTOH, if you are explicitly catching the mouse wheel events in the panel yourself and are not receiving them then you need to look at how you are binding the event handler and ensure that the binding will match events coming from any window because the ones you are sending are not coming from the panel itself like they normally would.

If neither of these fit your situation then MakingSampleApps - wxPyWiki (You should have that figured out by now.)

···

On 3/14/12 5:26 PM, 최원준 wrote:

and the parent of wx.Panel is wx.Frame. any idea about this?

--
Robin Dunn
Software Craftsman

my application is like this. wheel event is in STC.
on 2.8, it works well. but on 2.9 it doesn’t.

class STC(wx.stc.StyledTextCtrl):
def init(self, *args, **kwargs):

    self.Bind(wx.EVT_MOUSEWHEEL, self.moveparentpanel)

def moveparentpanel(self, event):
    self.GetParent().GetEventHandler().ProcessEvent(event)
    event.Skip()

class TestPanel(wx.Panel):

def OnControl(self, event=None):
    self.editor = STC(self.scrolled_panel)

class MyNotebook(wx.lib.agw.flatnotebook.FlatNotebook):
def init(self, parent):

def NewTab(self):
    self.textctrl = TestPanel(self)

class ToolbarFrame(wx.Frame):

def __init__(self, parent, id):
    wx.Frame.__init__(self, parent, id, 'Test Program', size=(800, 500))

    self.note = MyNotebook(self)