SDI and MDI

In many GUI applications, we will arrive at a situation where we need to open more than one document at a time to process them. We will want to design our application to handle this. This can be achieved by either of two approaches, namely, SDI and MDI. A Single Document Interface (SDI) application implements this by creating separate windows for each of the documents. This is done by creating a window subclass that handles everything by itself, including loading, saving, cleaning up, and so on. Each of the documents will be a clone of the main window having a separate menu bar, toolbar, and status bar on its own. Each of the main window instances must be able to act independently. However, there are some disadvantages to this approach. This approach consumes a lot of resources and it would be very inconvenient to open many windows at a time and keep track of them.

The second approach is to use a Multiple Document Interface (MDI) application where the central widget is instantiated with multiple instances. All these widgets will be interrelated within the main window and share the common menu bar, toolbar, and other components. MDI applications will use lesser resources compared with SDI applications. The MDI applications are provided with an extra menu to manage between windows because shifting between them is not controlled by the underlying operating system. We will discuss more about SDI and MDI, and their implementation in Chapter 5, Dialogs and Widgets.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.85.221