RE: How do I disable mousewheel scrolling?
Steve Barnes <[email protected]>
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <VI1PR03MB4479B2B6BF64F8342688517F9B980@VI1PR03MB4479.eurprd03.prod.outlook.com> |
Lawrence, Event handling and such is a bit of a mystery for many people. The trick I think would be to have a handler something along the lines of: def NoMouseWheel(self, evt): """ Don't action the mousewheel """ evt.Skip(False) And for those controls, that when they have the focus you don’t wish mouse wheel to do anything, you do self.control.Bind(wx.EVT_MOUSEWHEEL, self. NoMouseWheel) on that control. wxGlade doesn’t seem to of heard of MOUSEWHEEL events yet ☹ In the demo code for wx.Choice I tried and sure enough the mousewheel changes the value when the choice has focus, but with the change below it doesn’t: [cid:[email protected]] You should be able to put the method into an import file, e.g. GUI_Utils.py, and handle this via the code tab for each of the controls. Hope that helps. Steve From: [email protected] <[email protected]> On Behalf Of Lawrence Gray Sent: 19 June 2020 16:16 To: [email protected] Subject: Re: [wxPython-users] How do I disable mousewheel scrolling? Thank you for replying. That was actually my first thought but I couldn't implement it and still seem unable to do so. None of the wxPython demo programs provides the necessary insight for me. Event handling is still a mystery I am trying to come to grips with. If you could provide more detail, it would be greatly appreciated. As I am currently using wxGlade to generate the GUI code and trying to keep any business code separate from the GUI code I would ultimately prefer to implement a solution within the confines of the wxGlade project, but if that is not feasible, I will have to move out of my comfort zone. I am attaching my wxGlade project file and the code it generates for anyone so inclined to look at it. I am using wxGlade v0.9.6, python3.5.2 and wxPython4.0.3 Regards -- ________________________________ Lawrence Gray ________________________________ On Fri, 19 Jun 2020 at 05:08, Steve Barnes <[email protected]<mailto:[email protected]>> wrote: Rather than attempting to Disable mouse wheel scrolling you simply add a handler, to the controls that you don’t want to react to the mouse wheel, for EVT_MOUSEWHEEL which just does nothing. Then when those controls have focus nothing happens on mouse wheel events. Hope that helps. Steve Barnes From: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>> On Behalf Of Lawrence Gray Sent: 18 June 2020 18:14 To: [email protected]<mailto:[email protected]> Subject: [wxPython-users] How do I disable mousewheel scrolling? I have created a simple application part of which incorporates a number (10) of choice elements in a horizontal sizer . These are displayed above a listCtrl and have their width resized to match the widths of the columns in the listCtrl. They effectively form headers for the listCtrl data. The selection in each choice box controls the disposition of the data in that column in subsequent processing. The selection list in all of the choice controls are identical. Some of the selection choices must be unique for the data presented in the listCtrl, ie. no two columns can have identical selections. Some selection choices are allowed multiple times and some selection choices are mutually exclusive. For example, if one column is labelled "Date", which logically should be unique for my purpose, and another column choice selection is set to "Date", the previous column is reset to the default value "--NA--", which means that column data is mow ignored. My problem is that when I make a choice selection in one column and inadvertently or purposely scroll the mouse wheel, the choice selections in other columns are quickly altered as the choice selection list is scrolled, creating havoc. My question is, how do I disable mouse wheel scrolling of the selection list, after making my selection? Is this to the best or only way to get around the problem? What about, after making a selection, altering the focus to the listCtrl, where scrolling of the mouse wheel would not matter? This is my first attempt at creating any GUI application. I am using wxPython in conjunction with wxGlade. Any advice is appreciated. Regards -- ________________________________ Lawrence Gray ________________________________ -- You received this message because you are subscribed to the Google Groups "wxPython-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/CAJFU_KpgTZ-O8Rt5CTex%3DyEH0HA0xh_BO%2B6wpV_tKpscLaFZvg%40mail.gmail.com<https://groups.google.com/d/msgid/wxpython-users/CAJFU_KpgTZ-O8Rt5CTex%3DyEH0HA0xh_BO%2B6wpV_tKpscLaFZvg%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "wxPython-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/VI1PR03MB447915C53481DA6B0FA968739B980%40VI1PR03MB4479.eurprd03.prod.outlook.com<https://groups.google.com/d/msgid/wxpython-users/VI1PR03MB447915C53481DA6B0FA968739B980%40VI1PR03MB4479.eurprd03.prod.outlook.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "wxPython-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/CAJFU_KqJzhjH36ZpVU510rajKMn1sJwa7nbDgPMmosGA02LoxQ%40mail.gmail.com<https://groups.google.com/d/msgid/wxpython-users/CAJFU_KqJzhjH36ZpVU510rajKMn1sJwa7nbDgPMmosGA02LoxQ%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "wxPython-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/VI1PR03MB4479B2B6BF64F8342688517F9B980%40VI1PR03MB4479.eurprd03.prod.outlook.com.
image001.png
(image/png, 119.5 KB) - not displayed