ScrollBar

ScrollBarNew

Create a vertical or horizontal scroll bar

Syntax

Signature
ScrollBar     *ScrollBarNew( int start, int end, int offset, ScrollBarBlock sBlock, int orient );

Arguments

start, end the inclusive positions of the previous and next arrows. These are rows for a vertical bar and columns for a horizontal bar. NIL is invalid for either position.

offset the fixed column for a vertical bar or the fixed row for a horizontal bar. NIL is invalid.

sBlock a C function called by ScrollBarUpdate() before calculating the thumb position, or NULL for no callback.

orient SCROLL_VERTICAL or SCROLL_HORIZONTAL. NIL uses SCROLL_VERTICAL.

Return value

The new ScrollBar object, or NULL when a coordinate is NIL or the orientation is invalid. Release it with ScrollBarFree().

Description

Include xdev-wtui-classes.h. The current item starts at `1`, the total at `100` and the stored thumb position at `1`. The track between the arrows is `end - start - 1` cells long. The default style follows the orientation, and the colors come from the current `SetColor()` setting.

Set the item count and current item to match the data, then draw the bar with `ScrollBarDisplay()`. Use `ScrollBarHitTest()` to identify clicks and `ScrollBarUpdate()` to move the thumb after changing the current item.

The terminal control draws characters in screen cells. The xBase bitmap property applies to graphical mode. The C display and update methods return logical results so the caller can check each operation. The corresponding xBase methods return the object.

See also