Chapter 10: MDI Interfaces and Workspaces
Multiple document interface (MDI) represents one of the most common user interface designs on the Windows platform. MDI interfaces provide a single application window that contains multiple child windows (and optionally other windows like toolbars and floating palettes). MDI windows turn up in some form or another in most complex applications, and Visual Studio .NET is no exception.In this chapter, you learn how to create an MDI application in .NET, and how it's dramatically easier to use and more flexible than in previous programming toolkits. You also learn basic window management and synchronization with the document-view architecture. Finally, toward the end of the chapter, you explore one of the trickiest aspects of MDI interfaces with dockable windows.
The Story of MDI
MDI windows have been the de facto standard for user interfaces for the past several years, although their dominance is fading. Newer Windows applications sometimes use multiple independent SDI (single-document interface) windows instead. For example, Internet Explorer is an SDI application-if you want to open several pages at once, the pages appear in several windows, each of which is shown on the taskbar. Microsoft Word has also become an SDI application, although it was one of the earliest MDI examples in the Windows world. Most other word processors and document applications use MDI interfaces, and Visual Studio .NET is irredeemably MDI. Though it provides a unique user interface with tabbed and grouped windows, the basic principle-hosting several different windows in one large container-remains unchanged.The debate between SDI and MDI is sometimes heated. There is no clear standard, although Microsoft officially states that SDI is easier to use and preferred. The best design depends on the purpose of your application and the user it is designed to serve. If you are dealing with advanced users who need to manage several views simultaneously, an MDI interface is usually better than scattering multiple windows across the taskbar. On the other hand, if you are creating a simple editor for a novice user, it's probably clearer to follow a simpler SDI design like that used in Microsoft Paint of WordPad.
Types of MDI Applications
There are essentially two types of MDI applications:
Document applications. These applications use a single application window to contain multiple identical document windows. In a word processing program, this might provide a simple way for a user to work with several files at once.
Workspace applications. These applications provide several different windows (which correspond to different features) that can all be displayed simultaneously. For example, you might create a project management program that allows you to simultaneously browse through a list of users, enter new projects, and report software bugs. This could be modeled in an Explorer-style SDI interface application, but the user would only be able to perform one task at a time.