Associates a horizontal and/or vertical scrollbar to the element.
"VERTICAL", "HORIZONTAL", "YES" (both) or "NO" (none).
Default: "NO"
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.
Hence you can clearly deduce that POSX is limited to XMIN and XMAX-DX, or XMIN<=POSX<=XMAX-DX.
IMPORTANT: the LINEX, XMAX and XMIN attributes are only updated in the scrollbar when the DX attribute is updated.
IMPORTANT: when working with a virtual space with integer coordinates, 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 1.0 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 if XAUTOHIDE=Yes. The width of the vertical scrollbar (the same as the height of the horizontal scrollbar) can be obtained using the SCROLLBARSIZE global attribute (since 3.9).
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.
Changes in the scrollbar parameters do NOT generate ACTION nor SCROLL_CB callback events. If you need to update the canvas contents call your own action callback or call IupUpdate.
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
IupList, IupTree, and IupText/IupMultiline scrollbars are automatically managed and do NOT have the POS, MIN, MAX and D attributes.
IupList, IupMultiline, IupCanvas, POSX, XMIN, XMAX, DX, XAUTOHIDE, POSY, YMIN, YMAX, DY, YAUTOHIDE.