Getting the Current Value, Range, and Thumb Position for a Scroll Bar

To get the current range for the scroll bar, call:

int wn_sbrange(minp, maxp, sb_type, wnp)
 
int *minp;
/* Pointer to variable to place min of range
*/
int *maxp;
/* Pointer to variable to place max of range
*/
ULONG sb_type;
/* HSBAR or VSBAR
*/
WINDOWPTR wnp;
/* Pointer to window with scroll bar    
*/

To get the current value for the scroll bar, call:

int wn_sbval(sb_type, wnp)
 
ULONG sb_type;
/* Scroll bar type (HSBAR or VSBAR)
*/
WINDOWPTR wnp;
/* Pointer to window with scroll bar
*/

The scroll bar type can be HSBAR or VSBAR. The value returned by wn_sbval() represents the thumb's current value within the range.

You can determine the position of the thumb in the page region by calling:

int wn_sbthumb(sb_type, wnp);
 
ULONG sb_type;
/* HSBAR or VSBAR
*/
WINDOWPTR wnp;
/* Pointer to window with scroll bar
*/

The value returned is the thumb's position in the page region. Numbering of character positions in the page region starts at 0. If you want to translate this value into a window coordinate, you must add the number of characters in the border before the page region begins (i.e., half the cover size).

For auto-update scroll bars, the minimum value is 0. The maximum for a vertical scroll bar is the number of the last row in the underlying memory screen buffer or memory file. The maximum for a horizontal scroll bar is the number of the last column. The current value for an auto-update vertical scroll bar is maintained as the current row of the underlying memory file or buffer. The current value for an auto-update horizontal scroll bar is maintained as the current column of the underlying memory file or buffer.


Home Contents Previous Next