wx.ScrollEvent¶
A scroll event holds information about events sent from stand-alone scrollbars (see wx.ScrollBar) and sliders (see wx.Slider).
Note that scrolled windows send the wx.ScrollWinEvent which does not derive from wx.CommandEvent, but from wx.Event directly - don’t confuse these two kinds of events and use the event table macros mentioned below only for the scrollbar-like controls.
The difference between EVT_SCROLL_THUMBRELEASE
and EVT_SCROLL_CHANGED
¶
The EVT_SCROLL_THUMBRELEASE
event is only emitted when actually dragging the thumb using the mouse and releasing it (This EVT_SCROLL_THUMBRELEASE
event is also followed by an EVT_SCROLL_CHANGED
event). The EVT_SCROLL_CHANGED
event also occurs when using the keyboard to change the thumb position, and when clicking next to the thumb (In all these cases the EVT_SCROLL_THUMBRELEASE
event does not happen). In short, the EVT_SCROLL_CHANGED
event is triggered when scrolling/ moving has finished independently of the way it had started. Please see the Widgets Sample (“Slider” page) to see the difference between EVT_SCROLL_THUMBRELEASE
and EVT_SCROLL_CHANGED
in action.
Events Emitted by this Class¶
Handlers bound for the following event types will receive one of the wx.ScrollEvent You can use EVT_COMMAND_SCROLL
… macros with window IDs for when intercepting scroll events from controls, or EVT_SCROLL
… macros without window IDs for intercepting scroll events from the receiving window – except for this, the macros behave exactly the same. parameters.
EVT_SCROLL: Process all scroll events.
EVT_SCROLL_TOP: Process
wxEVT_SCROLL_TOP
scroll-to-top events (minimum position).EVT_SCROLL_BOTTOM: Process
wxEVT_SCROLL_BOTTOM
scroll-to-bottom events (maximum position).EVT_SCROLL_LINEUP: Process
wxEVT_SCROLL_LINEUP
line up events.EVT_SCROLL_LINEDOWN: Process
wxEVT_SCROLL_LINEDOWN
line down events.EVT_SCROLL_PAGEUP: Process
wxEVT_SCROLL_PAGEUP
page up events.EVT_SCROLL_PAGEDOWN: Process
wxEVT_SCROLL_PAGEDOWN
page down events.EVT_SCROLL_THUMBTRACK: Process
wxEVT_SCROLL_THUMBTRACK
thumbtrack events (frequent events sent as the user drags the thumbtrack).EVT_SCROLL_THUMBRELEASE: Process
wxEVT_SCROLL_THUMBRELEASE
thumb release events.EVT_SCROLL_CHANGED: Process
wxEVT_SCROLL_CHANGED
end of scrolling events (MSW only).EVT_COMMAND_SCROLL: Process all scroll events.
EVT_COMMAND_SCROLL_TOP: Process
wxEVT_SCROLL_TOP
scroll-to-top events (minimum position).EVT_COMMAND_SCROLL_BOTTOM: Process
wxEVT_SCROLL_BOTTOM
scroll-to-bottom events (maximum position).EVT_COMMAND_SCROLL_LINEUP: Process
wxEVT_SCROLL_LINEUP
line up events.EVT_COMMAND_SCROLL_LINEDOWN: Process
wxEVT_SCROLL_LINEDOWN
line down events.EVT_COMMAND_SCROLL_PAGEUP: Process
wxEVT_SCROLL_PAGEUP
page up events.EVT_COMMAND_SCROLL_PAGEDOWN: Process
wxEVT_SCROLL_PAGEDOWN
page down events.EVT_COMMAND_SCROLL_THUMBTRACK: Process
wxEVT_SCROLL_THUMBTRACK
thumbtrack events (frequent events sent as the user drags the thumbtrack).EVT_COMMAND_SCROLL_THUMBRELEASE: Process
wxEVT_SCROLL_THUMBRELEASE
thumb release events.EVT_COMMAND_SCROLL_CHANGED: Process
wxEVT_SCROLL_CHANGED
end of scrolling events (MSW only).
Note
Note that unless specifying a scroll control identifier, you will need to test for scrollbar orientation with wx.ScrollEvent.GetOrientation
, since horizontal and vertical scroll events are processed using the same event handler.
Class Hierarchy¶
Methods Summary¶
Constructor. |
|
Returns |
|
Returns the position of the scrollbar. |
|
Properties Summary¶
See |
|
See |
Class API¶
- class wx.ScrollEvent(CommandEvent)¶
Possible constructors:
ScrollEvent(commandType=wxEVT_NULL, id=0, pos=0, orientation=0) -> None
A scroll event holds information about events sent from stand-alone scrollbars (see ScrollBar) and sliders (see Slider).
Methods¶
- __init__(self, commandType=wxEVT_NULL, id=0, pos=0, orientation=0)¶
Constructor.
- Parameters:
commandType (wx.EventType)
id (int)
pos (int)
orientation (int)
- Return type:
None
- GetOrientation(self)¶
Returns
wx.HORIZONTAL
orwx.VERTICAL
, depending on the orientation of the scrollbar.- Return type:
int
- GetPosition(self)¶
Returns the position of the scrollbar.
- Return type:
int
- SetOrientation(self, orient)¶
- Parameters:
orient (int)
- Return type:
None
- SetPosition(self, pos)¶
- Parameters:
pos (int)
- Return type:
None
Properties¶
- Orientation¶
See
GetOrientation
andSetOrientation
- Position¶
See
GetPosition
andSetPosition