MDI Windows |
Top Previous Next |
Multiple Document Interface, or MDI, windows consist of a parent frame window and one or more child windows. Most word processors use the MDI interface as well as Emergence BASIC IDE. To create a MDI interface first open a window with @MDIFRAME as one of the style flags: OPENWINDOW frame,0,0,640,400,@MDIFRAME|@SIZE,0,”Main”,&main Any child window that uses an MDI frame as the parent parameter becimes an MDI child window: OPENWINDOW w,0,0,200,100,@SIZE|@MINBOX|@MAXBOX,frame,”Child”,&main The frame window will automatically contain a standard menu for minimizing, maximizing, restoring and arranging icons of the child windows. When ending your program it is not necessary to close all of the child windows individually. Closing just the frame window will also close all of the child windows. For default sized child windows you can use a special variable @USEDEFAULT for the left parameter. Windows will then pick a standard size for your window based on the current client size of the frame window: OPENWINDOW w,@USEDEFAULT,0,0,0,@SIZE|@MINBOX|@MAXBOX,frame,”Child”,&main You can use the same message subroutine for both the frame window and the child windows. In order to differentiate where the message is coming from, use the special @HITWINDOW variable. @HITWINDOW will contain a pointer to the originating window when your message subroutine is called. The following example fragment demonstrates this: SUB main Notes: The client of the frame window will automatically adjust its size to accommodate status windows and toolbars. You can't draw or PRINT into the frame window as it is just a place holder for MDI child window. The color of the client area in a frame window is determined by the users control panel settings. The example mdidemo.eba contains a complete example of a skeleton MDI program. It is a good place to start building MDI applications. |