Eventwait Comments

When converting from a traditional procedural program to an event-driven one, you will probably encounter situations where used to have an input prompt to wait for the user to select among many choices or confirm/cancel an operation. In the GUI model, such an input prompt may seem silly, since the layout of the screen (buttons, other things to click on) makes it obvious what the user needs to do without being prompted to type something. This EVENTWAIT class is perfect for such situations. Examples include:

• Menus, where in the text version you might have a prompt like "Enter Selection:" but now you have buttons.

• At the bottom of an input form, where in the text version you might have had an "Any Change?" prompt, but now you have buttons such as "OK" and "Cancel", with the implicit understanding that the user can just click on a field to edit it.

• Dialogs, especially those containing checkboxes and radio buttons (which do not require any special procedural coding and can instead just be queried upon exiting the dialog).

Although you do not need to specify a parent group, this concept is generally much clearer if you do group the relevant buttons within a parent. The best way to do this is with a Groupbox Control. Note that the group box need not take up any extra space or even be visible. (You can set its initial state to MBST_HIDE and its size to one row high, and place the buttons right on top of it.)

The BTNMNU.SBX routine encapsulates this logic in a wrapper making it easy to create and use (i.e. wait on) groups of buttons.

The TSTEVW sample program (see in EXLIB) provides detailed examples of using EVENTWAIT, both via BTNMNU.SBX and via AUI.SBR.

EVENTWAIT only allows the focus to be moved amongst controls that have the MBF_TABSTOP property. This property is automatic for regular buttons, and may be applied manually to check boxes and radio buttons. No other control type currently supports the MBF_TABSTOP property, although the EVW_INFLD flag will cause EVENTWAIT to act as if all INFLD controls had the MBF_TABSTOP property.