IupScrollbar
Creates a Scrollbar control. Allows the user to scroll through a range of values by moving a thumb indicator. Unlike the SCROLLBAR attribute used by IupCanvas, this is a standalone control.
Creation
Ihandle* IupScrollbar(const char *orientation);
orientation: optional orientation of the scrollbar. Can be NULL. See ORIENTATION attribute.
Returns: the identifier of the created element, or NULL if an error occurs.
Attributes
BGCOLOR: Background color of the scrollbar. Default: the global attribute DLGBGCOLOR. Not supported in Win32, WinUI and Android.
INVERTED (creation-only) (non-inheritable): Invert the minimum and maximum positions on screen. Default: NO. Not supported in macOS and WinUI.
LINESTEP: Controls the increment for keyboard arrows and single step clicks. It is not the size of the increment. The increment size is "linestep*(max-min)", so it must be 0<linestep<1. Default is "0.01".
MAX: Contains the maximum scrollbar value. Default is "1".
MIN: Contains the minimum scrollbar value. Default is "0".
ORIENTATION (creation-only) (non-inheritable): Informs whether the scrollbar is "VERTICAL" or "HORIZONTAL". Default: "HORIZONTAL".
PAGESIZE: The size of the visible page relative to the total range. It defines the size of the thumb indicator. The value is in the same units as MIN and MAX. Default is "0.1".
PAGESTEP: Controls the increment for PgDn and PgUp keys and page step clicks. It is not the size of the increment. The increment size is "pagestep*(max-min)", so it must be 0<pagestep<1. Default is "0.1".
RASTERSIZE (non-inheritable): The initial size depends on the orientation. For horizontal, the default width is 100 pixels and the height is the system scrollbar size. For vertical, the default height is 100 pixels and the width is the system scrollbar size.
VALUE (non-inheritable): Contains a number between MIN and MAX, indicating the scrollbar position. Default: "0".
ACTIVE, EXPAND, FONT, SCREENPOSITION, POSITION, MINSIZE, MAXSIZE, WID, TIP, SIZE, ZORDER, VISIBLE, THEME: also accepted.
Callbacks
VALUECHANGED_CB: Called after the value was interactively changed by the user.
int function(Ihandle *ih);
ih: identifier of the element that activated the event.
SCROLL_CB: Called when the user manipulates the scrollbar. Provides the scroll operation code and position.
int function(Ihandle *ih, int op, float posx, float posy);
ih: identifier of the element that activated the
event.
op: indicates the operation performed on the
scrollbar.
If the scrollbar is vertical, it can have the following values:
IUP_SBUP - line up
IUP_SBDN - line down
IUP_SBPGUP - page up
IUP_SBPGDN - page down
IUP_SBPOSV - vertical positioning
IUP_SBDRAGV - vertical drag
If it is horizontal, the following values are valid:
IUP_SBLEFT - column left
IUP_SBRIGHT - column right
IUP_SBPGLEFT - page left
IUP_SBPGRIGHT - page right
IUP_SBPOSH - horizontal positioning
IUP_SBDRAGH - horizontal drag
posx, posy: scrollbar position (only the one matching the orientation is meaningful).
Not all drivers report every operation code. In EFL only the drag (IUP_SBDRAGH, IUP_SBDRAGV) and positioning (IUP_SBPOSH, IUP_SBPOSV) codes are reported. The line operation codes (IUP_SBUP, IUP_SBDN, IUP_SBLEFT, IUP_SBRIGHT) are not reported in macOS, iOS, Android and EFL.
MAP_CB, UNMAP_CB, DESTROY_CB, GETFOCUS_CB, KILLFOCUS_CB, ENTERWINDOW_CB, LEAVEWINDOW_CB, K_ANY, HELP_CB: All common callbacks are supported.
Notes
The range of the scrollbar is defined by MIN and MAX. The PAGESIZE defines the size of the thumb indicator relative to the total range. The actual usable range for VALUE is from MIN to MAX-PAGESIZE.