An MDI (multiple-document interface) application means that a user can open several documents at the same time, and each document appears in a separate window in the client area of the main window of the application. Like word processor word is a typical MDI application, you can open and use multiple documents in Word, you can also create and open multiple slide applications in PowerPoint, and the spreadsheet allows users to edit multiple charts at the same time. MDI applications typically include three types of Windows:
* frame window: The frame window is similar to the main window of the application, with a resizable border, title bar, System menu, and so on. The application must register a window class for the frame window. An MDI application typically has only one frame window, and the frame window controls other types of Windows.
* Customer window: Client window provides management of subordinate MDI child windows, each MDI application has a client window.
* child window: When a user opens or creates a document, the client window creates a child window for the document. Each child window has a border that can be resized, a title bar, a system menu, a minimum maximize button, and so on. Only one child window at any given time is active. Child windows cannot exceed the scope of the client window.
Developing an MDI application with a generic development tool is rather cumbersome: you have to register frame and child window classes, create frame windows and client windows, write message loops and callback functions, create child windows, and so on, and each of these steps is not easy. But in Borland C + + Builder (hereinafter referred to as CB) implementation of MDI application is relatively simple, you just set the properties of the form Formstyle can be: the frame window Formstyle set to Fsmdiform, The Formstyle of the child window is set to Fsmdichild. In addition, CB itself also provides the MDI program template, select file| new| projects| MDI application, as shown in the following illustration:
CB will produce an MDI application framework. Direct compilation runs the program and you can see that the program already has the basic characteristics of an MDI program.
We use this template to design an MDI application. This program is a multiple document editor that supports multiple text and plain text formats, and also supports toolbar shortcuts and printouts. Let's talk about its specific development process: