The MicroStation dialog box manager incorporates many features that distinguish it from other graphical user interface programming systems. This section discusses these unique features and how they benefit MDL dialog box programmers.
Regardless of the underlying programming system being used, details about the items in the dialog box must be specified when creating a dialog box. MicroStation's dialog box manager is unique because the specification of a dialog box item can include detailed application knowledge. The dialog box manager item handlers, which implement the actual functionality of dialog box items, can use this information to modify an application variable without further effort by an MDL dialog box programmer.
For example, when a toggle button (also known as a check box or check button) is defined in a resource file, an application variable can be specified to determine whether the toggle button is on or off. When the user changes the state of the toggle button on the screen, the dialog box manager also changes the application variable. A MicroStation command, also defined as part of the item specification, can be placed in the input queue at this time. No program code needs to be written to support these actions.
Therefore, fully functional dialog boxes can be produced without any MDL programming at all, simply by defining dialog box item resources. These resources can be quickly created by copying existing item specifications and then modifying the copy to suit the new requirements.
MicroStation's dialog box items are highly comprehensive, and reduce the tasks of the programmer in a variety of ways. For example:
Many situations require giving the end-user multiple means for accessing and modifying a particular setting. Sometimes, users are more comfortable with typing in the new value for a parameter. At other times, they want several choices when changing the setting. It also may be desirable to create a different dialog box that changes the setting-though the setting can already be changed with an existing dialog box. By using a synonym resource, the MicroStation dialog box manager can correctly change the appearance of the appropriate dialog box items no matter what dialog box they appear in. Synonym resources are discussed in detail in a later section.
The MicroStation dialog box manager separates an item's "item list specification" (which mainly contains position information) from its "item resource specification" (which contains the "intelligence" of the item, including its application knowledge). This separation allows a single item resource specification to be reused in multiple dialog boxes and requires only the changing of the positioning information.
To use an existing dialog item in a different dialog box, only its resource type and resource ID are required. No knowledge of the contents of its item resource specification is needed. In particular, some of the items defined within MicroStation's resource files can be used by other applications. The "OK" and "Cancel" push buttons are good examples of dialog items defined in MicroStation's resource files that are reused extensively by other applications.
Usually, the more powerful dialog item handlers are, the less flexible they become. If the default behavior of an item is appropriate in a specific instance, it is not likely to be appropriate in many other situations. To counteract this problem, MicroStation's dialog box manager lets a programmer gain control at a low level and "defeat" (enhance) the manager's default processing. Usually, the default behavior is correct because so much application-specific behavior can be specified within a dialog item. But when the need arises, the MDL dialog box programmer can create and attach dialog and item hook functions to a dialog box or dialog item to gain more control of special situations.
Typically, hook functions are required when:
The generic item allows for the creation of a custom dialog item without requiring the construction of a dialog item handler. The MDL programmer has control over the appearance of a generic item and its response to mouse and keyboard events.
Since item handlers are separate loadable modules, changes can be shipped in small files without having to deliver an entirely new version of MicroStation. As new or updated item handlers are developed, software developers will be able to incorporate them easily for use with their applications.
An MDL dialog box application does not contain an input loop, since the MicroStation dialog box manager's internal input loop sends events directly to the appropriate item or dialog box. Hook functions, which can be attached to dialog boxes or dialog items to modify their default behavior, are therefore independent from each other and easier to write. These hook functions don't need to know about the existence or behavior of other dialog boxes or items to perform their work. They don't need to have switch statements that require information on all of the dialog boxes present in an application or all the items within a dialog box. This results in more modular functions and an easier to maintain application.
In addition, the MDL dialog box manager handles events for system controls internally. The MDL dialog box programmer need not be concerned with the management of extraneous events that can and should be handled automatically.
Since functional dialog boxes can be specified mainly in resource files, the prototype phase of program design can be completed very efficiently. For each successive design and test iteration, the resource compiler need only compile one small resource file in the entire application does not have to be recompiled or linked. Any program code can be kept to a minimum at this stage.
Because the resource syntax is virtually standard C data definitions, with the full power of the C-like pre-processor, programmers will find it easy to learn and use. The pre-processor #define directive is used extensively when specifying dialog item positions and sizes. This allows quick modifications to the position or size of multiple items by changing a single constant. The MDL pre-processor and the powerful basic interface components, combined with fast turnaround, results in a very effective prototyping tool.
In fact, dialog boxes can be designed by end-users unfamiliar with programming. The end-users can lay out the look and feel of the user interface for an application, while programmers simultaneously write the underlying processing code.
Applications can be designed with all of their text strings placed in a separate resource source file. Only this file needs to be translated to convert dialog box item labels and application messages to a different language. Program source code does not have to be supplied to translators. This protects proprietary information, while also making it easy to locate what needs to be translated.