## 4.10 Scrollbars

A scrollbar is used to scroll an object. To each scrollbar, there are three state variables: a total size, a display size and a starting position. Total size is the size of the object being scrolled, e.g. the total number of lines in a text widget; display size is the maximal size can be displayed simultaneously in a widget window, e.g. the number of lines in a text widget window; and starting position is the starting position of the object in the scrolled window, e.g. the index of the first line displayed in the text widget window.

### Widget Info

Symbolic widget type | EZ_WIDGET_VERTICAL_SCROLLBAR
Default class name | "VerticalScrollbar"
Default instance name | "verticalScrollbar"

Symbolic widget type | EZ_WIDGET_HORIZONTAL_SCROLLBAR
Default class name | "HorizontalScrollbar"
Default instance name | "horizontalScrollbar"

### Widget Interface Routines

`void EZ_UpdateScrollbar(EZ_Widget *widget, int maxsz, int pagsz, int start);`

update a scrollbar.

`void EZ_DoScroll(EZ_Widget *widget, int *offset, int mode);`

scroll a scrollbar.

`void EZ_GetScrollbarState(EZ_Widget *widget, int *ms, int *ps, int *st);`

retrieve the state of a scrollbar.

`int EZ_SetScrollbarDiscreteSpeed(EZ_Widget *widget, int speed);`

set the scroll step size. It's the speed of scrolling when the arrow is pressed.

### Screenshot

### Resources

Config_Option | ResourceName | DefaultValue
EZ_CLASS | class | `"VerticalScrollbar"`
|  | or `"HorizontalScrollbar"`
EZ_NAME | name | `"verticalScrollbar"`
|  | or `"horizontalScrollbar"`

EZ_X | x |
EZ_Y | y |
EZ_WIDTH | width |
EZ_HEIGHT | height |

EZ_LOCATION | location |
EZ_SIZE | size |
EZ_GEOMETRY | geometry |

EZ_WIDTH_HINT | widthHint |
EZ_HEIGHT_HINT | heightHint |
EZ_SIZE_HINT | sizeHint |

EZ_BORDER_WIDTH | borderWidth | `2`
EZ_BORDER_TYPE | borderType | `sunken`
EZ_FOCUS_PAD | focusPad | `2`

EZ_PADX | padx | `0`
EZ_PADY | pady | `0`
EZ_IPADX | iPadx | `0`
EZ_IPADY | iPady | `0`

EZ_EXPAND | expand | `false`
EZ_PROPAGATE | propagate | `true`
EZ_TRANSIENT | transient | `false`

EZ_CURSOR | cursor | `"XC_left_ptr"`
EZ_BUBBLE_STRING | bubbleString | `null`

EZ_CALLBACK | N/A | `null null`
EZ_MOTION_CALLBACK | N/A | `null null`
EZ_DESTROY_CALLBACK | N/A | `null null`
EZ_EVENT_HANDLER | N/A | `null null`

EZ_FOREGROUND | foreground | `"black"`
EZ_BACKGROUND | background | `"gray74`
EZ_BG_IMAGE_FILE | bgImageFile | `null`
EZ_BG_PIXMAP | N/A | `none`
EZ_HIGHLIGHT_FOREGROUND | highlightForeground |
EZ_HIGHLIGHT_BACKGROUND | highlightBackground |

EZ_BG_IMAGE_FILE_B | bgImageFileB | `null`
EZ_BG_PIXMAP_B | N/A | `none`
EZ_CLIENT_PTR_DATA | N/A | `null`
EZ_CLIENT_INT_DATA | clientIntData | `0`

EZ_DND_DRAG_CURSOR | dndDragCursor | `none`
EZ_DND_BUBBLE_STRING | dndBubbleString | `null`

EZ_SCROLLBAR_WIDTH | scrollbarWidth | `10`
EZ_SCROLLBAR_BORDER_WIDTH | scrollbarBorderWidth | `2`
EZ_HSCROLL_INCREMENT | hScrollIncrement | `1`
EZ_VSCROLL_INCREMENT | vScrollIncrement | `1`
EZ_GRIP_BUTTON_STYLE | gripButtonStyle | `0`

HTML Documentation Maintainance:`Arturo Espinosa <arturo@nuclecu.unam.mx>`