The Multiple Document Interface (MDl) was designed. to simplify the exchange of information among documents, all under the same roof. With an MDl application, you can maintain multiple open windows, but not multiple copies of the application. Data exchange is easier when you can view and compare many documents simultaneously.
You almost certainly use Windows applications that can open multiple documents at the same time and allow the user to switch among them with a mouse-click. Microsoft Word’is a typical example, although most people use it in single document mode. Each document is displayed. in its own window, and all document windows have the same behavior. The main form, or MDl Form, is not duplicated, but it acts as a container for all other windows, and it’s called the parent window. The windows in which the individual documents are displayed. are called child windows (or document windows). When you reposition the parent window on the Desktop, its child windows follow. Child windows, however, exist independently of the parent window. You can open and close child windows as you want, and child windows can even have different functions. For example, you can open a few text windows and a few graphics windows next to one another, although this is rare. ,
It shows Word in MDl mode. The application’s main window complains five documents, three of them in custom-size ‘windows and two of them minimized. The menus and the toolbars of the parent window apply to all the child windows. In reality, the menu bar of the MDl Form contains the menu of the active child Form.
Paint Shop Pro is a popular MDl application , and most mail applications display each message in a separate window and allow the user to open multiple messages. Most of the popular text editors (NotePad excluded) are MDI applications too.
MDl applications aren’t very common: not too many applications lend themselves to MDl implementation. Most of them are easier.to implement with multiple Forms, but some applications should be implemented. with an MDl interface. These are the applications that can open multiple documents of the same type and use a common menu structure that applies to all open documents, In the following sections we are going to discuss the basic behavior of MDl applications, their differences from regular Single Document Interface (SDl) applications, and how to build MDl applications.
Even if you don’t plan to develop MDl applications, you should take a look at the last section of this chapter, “Implementing Scrolling Forms,” to see how the MDI techniques can be used to build regular SDl Forms with scrolling capabilities. By default, Visual Basic’s Forms can’t be scrolled.If you want to build a really long or wide Form, you must either provide your own mechanism for scrolling it or break it into two or more smaller Forms. The techniques discussed in this chapter will enable you to build scrolling Forms that can fit in small windows and low resolution monitors.