3D PLM Enterprise Architecture

User Interface - Dialogs

CATDlgScrollBar

Scrolls windows and boxes
Quick Reference

CATDialog
  |
  +---CATDlgControl
        |
        +---CATDlgScrollbar

The Scroll Bar
CATDlgScrollBar.gif (4029 bytes) The scroll bar allows to set scrolling facilities to a scrollable dialog object. A scroll bar consists in a field (a shaft) ended on both sides by a scroll arrow between which an indicator (a scroll box, or thumb) shows the location of the data displayed with respect to the whole data. A scroll bar can be horizontal or vertical.

Use scroll bar whenever you display areas that don't fit in the available space.


Styles
Name Description
CATDlgCtrHorizontal The scrollbar is horizontal. This is the default.
CATDlgCtrVertical The scrollbar is vertical.

[Top]


Events
Notification Method Sent when
CATDlgScrollBarModifyNotification GetScrollBarModifyNotification Whenever the scroll arrows or the shaft is clicked
CATDlgScrollBarDragNotification GetScrollBarDragNotification Whenever the scroll box is dragged.

[Top]


Programmer's Guide

The scroll bar is assigned to a scrollable area.

[Top]

Constructing Scroll Bars

Construct scroll bars as follows:

Horizontal
_pHScrollBar = new CATDlgScrollBar (iParent, "HScrollBarId")
Vertical
_pVScrollBar = new CATDlgScrollBar (iParent, "VScrollBarId",
                                    CATDlgCtrVertical);

[Top]

Managing the Scrolling Range

The scroll bar range is managed using two parameters: a minimum value and a maximum value. The GetScrollRange and SetScrollRange methods enable their management:

int Min, Max;
_pScrollBar->GetScrollRange(Min, Max);
...
Min = 0;
Max = 100;
_pScrollBar->SetScrollRange(Min, Max);

[Top]

Managing the Scroll Box Position

The scroll box position is managed using the two methods GetScrollPos and SetScrollPos:

int ScrollBoxPosition = _pScrollBar->GetScrollPos();
...
ScrollBoxPosition = 25;
int Notify = 0;
_pScrollBar->SetScrollPos(ScrollBoxPosition, Notify);

Set the first parameter to the scroll box position you require, and the parameter Notify to a non null value if you want the corresponding notification to be sent. Otherwise set to 0, no notification is sent. The scroll box position must be set in the range defined by the minimum and maximum values.

[Top]

Managing the Scroll Box Size

The scroll box size is managed using the two methods GetScrollBoxSize and SetScrollBoxSize:

int ScrollBoxSize = _pScrollBar->GetScrollBoxSize();
...
ScrollBoxSize = 5;
int Notify = 0;
_pScrollBar->SetScrollBoxSize(ScrollBoxSize);

[Top]

Setting a Callback on a Scroll Bar

Set a callback on a scroll bar, for example, for scroll box drag, as follows:

AddAnalyseNotificationCB(
  _pScrollBar,                                    // scroll bar 
  _pScrollBar->GetScrollBarDragNotification(),    // notification
  (CATCommand)&Container::MethodToExecute,        // method to execute 
  CATCommandClientData iUsefulData);              // useful data for this method 

[Top]

Setting a Title to a Scroll Bar

The scroll bar title should be set by the resource file using a key built with the identifier you declare as the second parameter of the scroll bar constructor. It is never displayed.

[Top]


History

Version: 1 [Jan 2000] Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.