When we have dialogs with lots of options, we can often make things more manageable for the user by using tab widgets and stacked widgets. Tab widgets are especially useful for when we want the user to be able to view and edit all the available options. Stacked widgets are suitable for when we want the user to see only the currently relevant page of options. For stacked widgets we must provide a means by which the user can select the current page—for example, a combobox or a list widget of page names. When some of a dialog's options are "advanced" or infrequently needed, we can use an extension dialog, hiding the extra options unless the user asks to see them. Checked group boxes can be used to enable or disable the widgets they contain; this is useful if we want the user to be able to see the options available, even when they are disabled. For some dialogs, all of these approaches can be used in combination, although in such complex cases, the validation logic might become rather convoluted.
Splitters are very useful for creating multiple-widget main windows and give the user control over the relative sizes of the widgets. An alternative approach is to have a single central widget, and to put the other widgets in dock windows. Dock windows automatically put a splitter between themselves and the central widget when docked, and can be dragged from one dock area to another or floated free.
SDI makes it easy for users to open multiple documents inside the same application. SDI also makes possible some interaction across the windows, such as having "save all" and "quit" actions and a Window menu, that are not very easily achieved using a separate application instance for each document. The SDI approach is very fashionable, and although it is more resource-hungry than MDI, it is probably easier for very inexperienced users to understand than MDI.
MDI provides the same benefits as SDI, except that the document windows are constrained to appear within a single main window's central area. This avoids duplicating menus and toolbars, and it makes it easier to arrange windows in relation to one another. One drawback of MDI is that some users find it more difficult to understand than SDI, at least at first. MDI is not limited to having windows of just one widget type, although most modern MDI applications that use more than one widget type in the main window have one type for document windows, and the other types are put in dock windows.
In both the SDI and MDI example applications, all of the actions are enabled all of the time. This is not a problem since any actions that don't make sense harmlessly do nothing. However, to avoid confusing some users, it might be En-
better to enable or disable actions depending on the application's state; the abling sidebar in Chapter 13 shows how this can be done. and
DisLayouts, splitters, tab widgets, stacked widgets, dock windows, SDI, and MDI abling together provide a wide range of user interface design options. In addition, ^eb^ it is possible to create our own layouts in code, or to create our own layout managers, so the possibilities really are limitless.
Was this article helpful?