Scrollbars Attributes for IupGLControls (since 3.11)

Scrollbars are always enabled and they are always automatically shown or hidden accordingly to D* >= *MAX-*MIN.

Configuration Attributes (non inheritable)

DX: Size of the thumb in the horizontal scrollbar. Also the horizontal page size. Default: "10".

DY: Size of the thumb in the vertical scrollbar. Also the vertical page size. Default: "10".

POSX: Position of the thumb in the horizontal scrollbar. Default: "0".

POSY: Position of the thumb in the vertical scrollbar. Default: "0".

XMIN: Minimum value of the horizontal scrollbar. Default: "0".

XMAX: Maximum value of the horizontal scrollbar. Default: "100".

YMIN: Minimum value of the vertical scrollbar. Default: "0".

YMAX: Maximum value of the vertical scrollbar. Default: "100".

LINEX: The amount the thumb moves when an horizontal step is performed. Default: 1/10th of DX.

LINEY: The amount the thumb moves when a vertical step is performed. Default: 1/10th of DY.

Appearance Attributes (non inheritable)

BACKCOLOR (non inheritable): color used as background. Can have an alpha component. Default: "200 225 245". Used instead of BGCOLOR to avoid inheritance problems.

FORECOLOR (non inheritable): handler and arrow color. Can have an alpha component. Default: "110 210 230". Used instead of FGCOLOR to avoid inheritance problems.

HIGHCOLOR (non inheritable): handler and arrow color when highlight. Default: "90 190 255".

PRESSCOLOR (non inheritable): handler and arrow color when pressed. Default: "50 150 255".

SCROLLBARSIZE (non inheritable): The width of the vertical scrollbar or the height of the horizontal scrollbar. Default: 11.

Notes

The scrollbar allows you to create a virtual space associated to the element. In the image below, such space is marked in red, as well as the attributes that affect the composition of this space. In green you can see how these attributes are reflected on the scrollbar.

../attrib/images/scrollbar.gif (2113 bytes)

Hence you can clearly deduce that POSX is limited to XMIN and XMAX-DX, or  XMIN<=POSX<=XMAX-DX.

IMPORTANT: set XMAX to the integer size of the virtual space, NOT to "width-1", or the last pixel of the virtual space will never be visible. If you decide to let XMAX with the default value of 100 and to control only DX, then use the formula DX=visible_width/width.

When the virtual space has the same size as the canvas, DX equals XMAX-XMIN, the scrollbar is automatically hidden. The width of the vertical scrollbar (the same as the height of the horizontal scrollbar) can be obtained using the SCROLLBARSIZE attribute.

The same is valid for YMIN, YMAX, DY and POSY. But remember that the Y axis is oriented from top to bottom in IUP. So if you want to consider YMIN and YMAX as bottom-up oriented, then the actual YPOS must be obtained using YMAX-DY-POSY.

If you have to change the properties of the scrollbar (XMIN, XMAX and DX) but you want to keep the thumb still (if possible) in the same relative position, then you have to also recalculate its position (POSX) using the old position as reference to the new one. For example, you can convert it to a 0-1 interval and then scale to the new limits:

old_posx_relative = (old_posx - old_xmin)/(old_xmax - old_xmin)
posx = (xmax - xmin)*old_posx_relative + xmin

Affects

IupGLScrollBox

See Also

POSX, XMIN, XMAX, DX, POSY, YMIN, YMAX, DY