EZwgl (2 Using EZ Widgets)

# 2 Using EZ Widgets

There are two classes of widgets in the EZ widget library: a class of primitive widgets each of which is implemented using exactly one X window, and a class of composite widgets which are made from a group of primitive widgets. Label, frame, buttons, menu-items, entry and sliders are examples of simple widgets while text widget, list box, notebook and notebook-page are composite widgets.

Widgets in EZwgl are event-driven. Interaction between an application and the EZ widget library is achieved via callbacks and event handlers. Typically, an EZwgl application contains five components: initialization, creating and configuring widgets, registering widget callbacks and/or event handlers, mapping widgets and handling events.

EZwgl supports application resources. Appearance of an EZwgl application is completely configurable by resource files.

EZwgl does not support event-action translations. Functionality of an EZwgl cannont be modified by resources.

EZwgl supports geometry management. It includes four geometry managers: row geometry manager (layout children in rows), column geometry manager (layout children in columns), row-column geometry manager (aka the grid bag geometroy manager) and a simplified version of it (the default).

There are some subtle differences between primitive widgets and composite widgets.

- For a primitive widget, events are dispatched to the widget event handler; callbacks, event handlers and client data are registered to the widget data structure. For a composite widget, however, events are dispatched to whatever children widgets that are involved; callbacks, event handlers and client data, if set, are attached to the most relevent widget. For example, in a Listbox widget, these information are automatically registered to the Internal Listbox widget.

- For a primitive widget, children widgets are the direct descendants of the widget; for a composite widget, children widgets are arranged as the children of the top-most frame of the composite widget.

- If one sends an event to a composite widget, the event goes to the top-most frame, generating some undesired results. For example, if one sends a `EZ_KEY_PRESS` event to a text widget, nothing will happen because the frame ignores key events. To really send a key event to a text widget, one has to extract the internal-text-widget component and send the event to it.

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