A scroll event holds information about events sent from stand-alone scrollbars and sliders. Note that starting from wxWidgets 2.1, scrolled windows send the wxScrollWinEvent which does not derive from wxCommandEvent, but from wxEvent directly - don't confuse these two kinds of events and use the event table macros mentioned below only for the scrollbar-like controls.
Derived from
wxCommandEvent
wxEvent
wxObject
Include files
<wx/event.h>
Event table macros
To process a scroll event, use these event handler macros to direct input to member functions that take a wxScrollEvent argument. 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.
EVT_SCROLL(func) | Process all scroll events. |
---|---|
EVT_SCROLL_TOP(func) | Process wxEVT_SCROLL_TOP scroll-to-top events (minimum position). |
EVT_SCROLL_BOTTOM(func) | Process wxEVT_SCROLL_TOP scroll-to-bottom events (maximum position). |
EVT_SCROLL_LINEUP(func) | Process wxEVT_SCROLL_LINEUP line up events. |
EVT_SCROLL_LINEDOWN(func) | Process wxEVT_SCROLL_LINEDOWN line down events. |
EVT_SCROLL_PAGEUP(func) | Process wxEVT_SCROLL_PAGEUP page up events. |
EVT_SCROLL_PAGEDOWN(func) | Process wxEVT_SCROLL_PAGEDOWN page down events. |
EVT_SCROLL_THUMBTRACK(func) | Process wxEVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent as the user drags the thumbtrack). |
EVT_SCROLL_THUMBRELEASE(func) | Process wxEVT_SCROLL_THUMBRELEASE thumb release events. |
EVT_SCROLL_ENDSCROLL(func) | Process wxEVT_SCROLL_ENDSCROLL end of scrolling events (MSW only). |
EVT_COMMAND_SCROLL(id, func) | Process all scroll events. |
EVT_COMMAND_SCROLL_TOP(id, func) | Process wxEVT_SCROLL_TOP scroll-to-top events (minimum position). |
EVT_COMMAND_SCROLL_BOTTOM(id, func) | Process wxEVT_SCROLL_TOP scroll-to-bottom events (maximum position). |
EVT_COMMAND_SCROLL_LINEUP(id, func) | Process wxEVT_SCROLL_LINEUP line up events. |
EVT_COMMAND_SCROLL_LINEDOWN(id, func) | Process wxEVT_SCROLL_LINEDOWN line down events. |
EVT_COMMAND_SCROLL_PAGEUP(id, func) | Process wxEVT_SCROLL_PAGEUP page up events. |
EVT_COMMAND_SCROLL_PAGEDOWN(id, func) | Process wxEVT_SCROLL_PAGEDOWN page down events. |
EVT_COMMAND_SCROLL_THUMBTRACK(id, func) | Process wxEVT_SCROLL_THUMBTRACK thumbtrack events (frequent events sent as the user drags the thumbtrack). |
EVT_COMMAND_SCROLL_THUMBRELEASE(func) | Process wxEVT_SCROLL_THUMBRELEASE thumb release events. |
EVT_COMMAND_SCROLL_ENDSCROLL(func) | Process wxEVT_SCROLL_ENDSCROLL end of scrolling events (MSW only). |
The difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_ENDSCROLL
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_ENDSCROLL event).
The EVT_SCROLL_ENDSCROLL 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_ENDSCROLL event is triggered when scrolling/ moving has finished. The only exception (unfortunately) is that changing the thumb position using the mousewheel does give a EVT_SCROLL_THUMBRELEASE event but NOT an EVT_SCROLL_ENDSCROLL event.
Please see the widgets sample ("Slider" page) to see the difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_ENDSCROLL in action.
Remarks
Note that unless specifying a scroll control identifier, you will need to test for scrollbar orientation with wxScrollEvent::GetOrientation, since horizontal and vertical scroll events are processed using the same event handler.
See also
wxScrollBar, wxSlider, wxSpinButton,
wxScrollWinEvent, Event handling overview
Constructor.
int GetOrientation(void) const
Returns wxHORIZONTAL or wxVERTICAL, depending on the orientation of the scrollbar.
Returns the position of the scrollbar.
ymasuda 平成17年11月19日