EZwgl (4.11 ListBoxes)

## 4.11 ListBoxes

A listbox contains a list of items formatted into rows. When one of the items is selected, it is highlighted. When a double click of mouse button 1 occures on an item, the callbacks of the listbox are invoked.

The contents of a listbox is scrollable in both directions.

There are two types of listboxes in EZwgl, an internal listbox and a composite listbox. The latter is a composite widget made from a frame, an internal listbox and two scrollbars. From the application programmer's point of view, these two listboxes are the same.

### Widget Info

Symbolic widget type | EZ_WIDGET_LISTBOX
Default class name | "ListBox"
Default instance name | "listBox"

Symbolic widget type | EZ_WIDGET_ILISTBOX
Default class name | "IListBox"
Default instance name | "iListBox"

### Subwidgets Info

Subwidgets of ListBox are listed below.

               ( iListBox
     listBox-->( horizontalScrollbar
               ( verticalScrollbar

### Widget Interface Routines

`void EZ_GetListBoxWidgetComponents(EZ_Widget *widget, EZ_Widget **ilb,`

`EZ_Widget **hsc, EZ_Widget **vsc);`

return the subwidgets of a composite listbox.

`void EZ_ClearListBox(EZ_Widget *widget);`

clear a listbox.

`void EZ_SetListBoxItems(EZ_Widget *widget, char **items, int nitems);`

set up the list in a listbox.

`void EZ_AppendListBoxItem(EZ_Widget *widget, char *item);`

append one item at the end of a listbox.

`void EZ_InsertListBoxItem(EZ_Widget *widget, char *str, int idx);`

insert an item at the given location.

`void EZ_DeleteListBoxItem(EZ_Widget *widget, int idx);`

delete the item at the specified location.

`void EZ_DeleteListBoxString(EZ_Widget *widget, char *str);`

find the item and delete it.

`char *EZ_GetListBoxSelectedItem(EZ_Widget *widget);`

`char *EZ_GetListBoxSelection(EZ_Widget *widget);`

return the selected item in a listbox.

`int EZ_GetListBoxSelectionLineNumber(EZ_Widget *widget);`

return the selection index.

`void EZ_ModifyListBoxItem(EZ_Widget *widget, char *nitem, int idx);`

replace the item at the specified location by the given string.

`void EZ_ListBoxSelectItem(EZ_Widget *widget, char *str);`

find the specified item and make it the current selection.

`void EZ_ListBoxSelectItemUsingIdx(EZ_Widget *widget, int idx);`

make the item at the specified location the current selection.

`void EZ_GetListBoxState (EZ_Widget *widget, int *xoff, int *line1);`

return the current xoffset and yoffset (index of the first line).

`void EZ_SetListBoxState (EZ_Widget *widget, int xoff, int line1);`

set the current xoffset and yoffset (index of the first line).

`void EZ_GetListBoxData(EZ_Widget *widget, listboxentry **dat, int *cnt);`

return the internal listbox data. One should not modify them.

### Screenshot

### Resources

Config_Option | ResourceName | DefaultValue
EZ_CLASS | class | `"ListBox"`
|  | or`"IListBox"`
EZ_NAME | name | `"listBox"`
|  | or`"iListBox"`

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 | `0`
EZ_BORDER_TYPE | borderType | `none`
EZ_FOCUS_PAD | focusPad | `0`

EZ_PADX | padx | `0` or `8`
EZ_PADY | pady | `0` or `6`
EZ_IPADX | iPadx | `0`
EZ_IPADY | iPady | `0`

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

EZ_FONT_ID | fontID | `3`
EZ_FONT_NAME | fontName | `"*Bold*"`
EZ_TEXT_LINE_LENGTH | textLineLength | `30`

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_SELECTION_BACKGROUND | selectionBackground |
EZ_SELECTION_FOREGROUND | selectionForeground |
EZ_TEXT_BACKGROUND | textBackground |
EZ_ROW_BG | rowBg | `off nil nil`

EZ_OPTIONAL_HSCROLLBAR | optionalHScrollbar | `true`
EZ_OPTIONAL_VSCROLLBAR | optionalVScrollbar | `true`

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