Adding Automatically Updated Scroll Bars to a Window

The easiest way to use scroll bars is to use auto-update scroll bars. The thumb position is automatically updated to reflect the current position of the window in the underlying buffer. There is only one call necessary to assign scroll bars to the window. Whenever the origin of the window in the buffer changes, the position of the thumb is updated.

Designer: Auto-update scroll bars can be added with the Designer. See the Designer User's Guide for more information. You can also add them to your Designer window in your code, by calling the function sw_sb() described below.

Code: Auto-update scroll bars are added by calling the set window scroll bar function, sw_sb():

int sw_sb(option, sb_type, wnp);
 
int option;
/* Scroll bar update option
*/
ULONG sb_type;
/* Scroll bar type
*/
WINDOWPTR wnp;
/* Pointer to window
*/

Specify AUTOUPD for the scroll bar update option option.

Specify one of the following scroll bar types for sb_type:

HSBAR Horizontal scroll bar
VSBAR Vertical scroll bar
HVSBAR Vertical and horizontal scroll bars

If you add scroll bars to a window that is already displayed, you must call v_bdr() to redisplay the border with the scroll bars.


Home Contents Previous Next