|
In a custom MDI frame, PowerBuilder does not size the client area so you must size it in the script for the Resize event in the frame.
When you create and save a MDI frame, PowerBuilder creates a control called mdi_1. PowerBuilder uses mdi_1 to identify the client area of the frame (the area that holds the sheets). mdi_1 displays in the list of objects in the PowerScript Painter Paste Objects drop-down list box.
To size or resize the client area when the frame is opened or resized, write a script for the Resize event in the frame window that determines the size of the frame and then sizes the client area (mdi_1) appropriately.
TIP: mdi_1 is not a reserved word, but should be used with caution.
For example, this script sizes the client area for the frame w_mdi_custom2. The frame has a series of CommandButtons across the top below the menu and MicroHelp at the bottom of the frame.
int nWidth, nHeight
// Obtain the width and height of the workspace nWidth = WorkSpaceWidth (w_mdi_custom2) nHeight = WorkSpaceHeight (w_mdi_custom2)
// Calculate workspace between the CommandButtons // and the MicroHelp. cb_1 is the CommandButton // nearest the top left-corner of the frame. nHeight = nHeight - (cb_1.y + cb_1.height) nHeight = nHeight - (mdi_1.microhelpheight)
// Move the upper-left corner of the client area (mdi_1) // to the bottom-left corner of the CommandButton (cb_1). Move (mdi_1, 0, cb_1.height)
// Resize the client area. The frame window has a line // below the buttons at the top of the window so add 4 // to nHeight to allow for the line. Resize (mdi_1, nWidth, nHeight + 4)
Note:MicroHelpHeight is an attribute of mdi_1 that PowerBuilder sets when you select a window type for your MDI window. If you select MDI Frame, there is no MicroHelp and MicroHelpHeight is 0; if you select MDI Frame with MicroHelp, MicroHelpHeight is the height of the MicroHelp.
|