IScrollHandler

The IScrollHandler class handles events resulting from a user interacting with an IScrollBar object, such as when the user clicks on the down scroll button of a scroll bar.

Create a handler derived from IScrollHandler and attach it to a scroll bar's owner window. You can do this by calling IHandler::handleEventsFor to pass the owner window to the scroll handler.

When the scroll handler receives a scroll event, it creates an IScrollEvent object and routes that object to the appropriate IScrollHandler virtual function. Override these virtual functions to supply your own specialized processing of a scroll event.

The return value from the virtual functions specifies whether the scroll event is passed on for additional processing, as follows:

true
The scroll event requires no additional processing. Do not pass it to another handler.
false
The scroll event requires additional processing. Pass the scroll event to the next handler for additional processing, as follows:
  • If there is another handler for the scroll bar's owner window, pass the scroll event to the next handler.
  • If this is the last handler for the owner window, call IWindow::defaultProcedure to process the scroll event.

Portability Considerations

Scroll events are not dispatched to the IScrollBar object itself, but to the IScrollBar's owner window.

The Motif scroll bar has slightly different characteristics than the OS/2 and Windows scroll bars. The Presentation Manager and Windows scroll box does not automatically scroll to a new position when the user requests a change in position, unless the user drags the scroll box. The IScrollHandler can move the scroll box by calling moveScrollBox with the IScrollEvent object.

In contrast, the Motif version of the scroll bar uses the XmScrollBar widget, which automatically moves the scroll box to its new position before the event is dispatched to this handler.

You can obtain portable code by always calling moveScrollBox and using the IScrollEvent to determine the new position. The Presentation Manager and Windows versions move the scroll box to the new location and the Motif version moves the scroll box to its current position.


IScrollHandler - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of this class.


[view class]
~IScrollHandler
public:
virtual ~IScrollHandler()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IScrollHandler
public:
IScrollHandler()

This is the default constructor and accepts no parameters.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Event Dispatching

Event-dispatching members evaluate an event to determine if it is appropriate for this handler object to process it. If it is, it calls the virtual function used to process the event.


[view class]
dispatchHandlerEvent
protected:
virtual bool dispatchHandlerEvent(IEvent& event)

If a scroll event is received, the appropriate virtual function is called.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Event Processing

Event-processing members must be supplied to process a scroll event. You can override these virtual members in a derived class.


[view class]
lineDown
protected:
virtual bool lineDown(IScrollEvent& event)

Scrolls down one line. Derived classes implement this function to process a scroll event that a user initiates by selecting the down scroll button of a vertical scroll bar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
lineLeft
protected:
virtual bool lineLeft(IScrollEvent& event)

Scrolls left one line. Derived classes implement this function to process a scroll event that a user initiates by selecting the left scroll button of a horizontal scroll bar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
lineRight
protected:
virtual bool lineRight(IScrollEvent& event)

Scrolls right one line. Derived classes implement this function to process a scroll event that a user initiates by selecting the right scroll button of a horizontal scroll bar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
lineUp
protected:
virtual bool lineUp(IScrollEvent& event)

Scrolls up one line. Derived classes implement this function to process a scroll event that a user initiates by selecting the up scroll button of a vertical scroll bar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
pageDown
protected:
virtual bool pageDown(IScrollEvent& event)

Scrolls down one page. Derived classes implement this function to process a scroll event that a user initiates by selecting the scroll shaft below the scroll box of a vertical scroll bar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
pageLeft
protected:
virtual bool pageLeft(IScrollEvent& event)

Scrolls left one page. Derived classes implement this function to process a scroll event that a user initiates by selecting the scroll shaft to the left of the scroll box of a horizontal scroll bar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
pageRight
protected:
virtual bool pageRight(IScrollEvent& event)

Scrolls right one page. Derived classes implement this function to process a scroll event that a user initiates by selecting the scroll shaft to the right of the scroll box of a horizontal scroll bar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
pageUp
protected:
virtual bool pageUp(IScrollEvent& event)

Scrolls up one page. Derived classes implement this function to process a scroll event that a user initiates by selecting the scroll shaft above the scroll box of a vertical scroll bar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
scrollBoxTrack
protected:
virtual bool scrollBoxTrack(IScrollEvent& event)

Tracks the movement of the scroll box. Derived classes implement this function to process a scroll event that a user initiates by dragging the scroll box with the mouse.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
scrollBoxTrackEnd
protected:
virtual bool scrollBoxTrackEnd(IScrollEvent& event)

Ends the tracking of scroll box movement. Derived classes implement this function to process the end of a scroll event. Tracking ends when the user stops dragging the scroll box with the mouse.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
scrollEnd
protected:
virtual bool scrollEnd(IScrollEvent& event)

Ends a scroll event. Derived classes implement this function to process the end of a scroll event not caused by moving the scroll box. For example, the user releases the mouse button after clicking on a scroll button or scroll shaft.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Implementation

These members are called by many of the virtual functions to provide some default processing of a scroll event.


[view class]
moveScrollBox
protected:
virtual IScrollHandler& moveScrollBox(IScrollEvent& event)

Positions the scroll box based on the scroll event.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IScrollHandler - Inherited Member Functions and Data

Inherited Public Functions

IHandler

Inherited Public Data

Inherited Protected Functions

IHandler

Inherited Protected Data