Author: reinhard Date: 2009-12-09 16:22:15 -0600 (Wed, 09 Dec 2009) New Revision: 10113
Modified: trunk/gnue-forms/src/uidrivers/wx/widgets/entry.py Log: Bind entries to mouse wheel events, so the mouse wheel works even when the entry has a different block set than the containing box. Modified: trunk/gnue-forms/src/uidrivers/wx/widgets/entry.py =================================================================== --- trunk/gnue-forms/src/uidrivers/wx/widgets/entry.py 2009-12-09 22:11:43 UTC (rev 10112) +++ trunk/gnue-forms/src/uidrivers/wx/widgets/entry.py 2009-12-09 22:22:15 UTC (rev 10113) @@ -109,6 +109,11 @@ ctrl.Bind(wx.EVT_KEY_DOWN, self.__on_key_down) ctrl.Bind(wx.EVT_SET_FOCUS, self.__on_set_focus) + # If the control has a block assigned, we bind the mouse wheel event to + # scroll through the block's records. + if self._gfObject.get_block() is not None: + ctrl.Bind(wx.EVT_MOUSEWHEEL, self.__on_mousewheel) + return [self.__add_entry_label(parent), ctrl] # ------------------------------------------------------------------------- @@ -434,9 +439,20 @@ self._request(command, triggerName=args) else: event.Skip() - + # ------------------------------------------------------------------------- + def __on_mousewheel(self, event): + + block = self._gfObject.get_block() + + if event.GetWheelRotation() < 0: + block.next_record() + else: + block.prev_record() + + # ------------------------------------------------------------------------- + def __on_cbx_wheel(self, event): # On wx.MSW we stop the propagation of a mouse wheel event here, to _______________________________________________ commit-gnue mailing list commit-gnue@gnu.org http://lists.gnu.org/mailman/listinfo/commit-gnue