## 4.16 Optional Entry

An optional entry is also refered as a ComboBox. It is a composite widget built from an entry, a button and a listbox. It allows users to enter text via the entry and also provides a list of possible choices via the listbox. The entry can be either editable or non-editable. Option is also provided so that the listbox remembers the history of selected information.

There are two display styles (represented by 0 and 1) for an optional entry. The difference is the location where the arrow button is displayed. In the default style, the button is displayed outside the entry.

### Widget Info

Symbolic widget type | EZ_WIDGET_OPTIONAL_ENTRY
Default class name | "OptionalEntry"
Default instance name | "optionalEntry"

### Subwidgets Info

Instance names of subwidgets are listed below.

                     ( entry ....
                     (            arrowButton
     optionalEntry-->(   ........
                     (         ( iListBox
               ....... popup-->( horizontalScrollbar
                               ( verticalScrollbar

### Widget Interface Routines

`void EZ_GetOptionalEntryWidgetComponents(EZ_Widget *widget, EZ_Widget **entry,`

`EZ_Widget **listbox, EZ_Widget **btn);`

return the components of an optional entry.

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

set the text of an optional entry.

`char *EZ_GetOptionalEntryString(EZ_Widget *widget);`

retrieve the text in an optional entry.

`void EZ_OptionalEntryClearOptions(EZ_Widget *widget);`

clear the listbox associated to the optional entry.

`void EZ_SetOptionalEntryOptions(EZ_Widget *widget, char **items, int count);`

set items in the listbox associated to an optional entry.

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

append an item at the end of the listbox associated to the optional entry.

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

insert an item into the listbox at the specified location.

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

delete the specified item in the associated listbox.

`void EZ_SetOptionalEntryStyle(EZ_Widget *widget, int style);`

select one of the two display styles.

### Screenshot

### Resources

Config_Option | ResourceName | DefaultValue
EZ_CLASS | class | `"OptionalEntry"`
EZ_NAME | name | `"optionalEntry"`

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`
EZ_PADY | pady | `0`
EZ_IPADX | iPadx | `2`
EZ_IPADY | iPady | `0`

EZ_ORIENTATION | orientation | `horizontal`
EZ_FILL_MODE | fillMode | `fillHorizontally`
EZ_SIDE | side | `center`

EZ_FONT_ID | fontID |
EZ_FONT_NAME | fontName | `"*fixed*"`
EZ_LABEL_STRING | labelString | `null`

EZ_CURSOR | cursor | `"XC_xterm"`
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_SELECTION_BACKGROUND | selectionBackground |
EZ_SELECTION_FOREGROUND | selectionForeground |

EZ_ENTRY_STRING | entryString | `null`

EZ_POPUP_NAME | popupName | `"popup"`

EZ_ENTRY_EDITABLE | entryEditable | `true`
EZ_OPTIONAL_ENTRY_HISTORY | optionalEntryHistory | `true`
EZ_OPTIONAL_ENTRY_STYLE | optionalEntryStyle | `0`

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