Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Using scrollbar and scroll indicator widgets

The scroll widget is instantiated by calling ISHELL_CreateInstance() with the AEECLSID_CScrollWidget ClassID.

To decorate a content widget with a scrollbar widget, an application would do the following:

  1. Create the content widget that will be wrapped by a scrollbar.
  2. Call ISHELL_CreateInstance() with a ClassID of AEECLSID_CScrollbarWidget to retrieve a reference counted instance of the scrollbar widget.
  3. Call IDecorator_SetWidget() to wrap the scrollbar around the content widget.

Scrollbar Widget can be also used in Standalone mode (No Child Mode). When used in standalone mode, an external widget (such as TextWidget, ListWidget, or ViewportWidget) can be attached to a scrollbar widget using PROPEX_TARGETWIDGET property.

To attach a scrollbar widget to a target widget, an application would do the following:

  1. Create the content widget which the scrollbar will be attached.
  2. Call ISHELL_CreateInstance() with a ClassID of AEECLSID_CScrollbarWidget to retrieve a reference counted instance of the scrollbar widget.
  3. Call IWidget_SetTargetWidget() to attach the scrollbar to the target widget.

The scroll widget takes a dummy scroll model, primarily as an event driving mechanism for tracking and handling position changes to the scrollable content that a scroll widget wraps. As these changes are detected, the wrapped widget creates the scroll model on demand and generates the scroll event and notification that drives the scroll widget to update itself to reflect the user's movements through the scrollable content.

Note: The scrollbar widget should only be used as a decorator for widgets that are capable of sending ScrollEvents via their view model. If the scrollbar widget is set as the decorator for a widget that does not send scroll events through its view model, the scrollbar widget cannot be displayed correctly.