Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

WMDIChild:Init() Method
Construct an MDI child window object
------------------------------------------------------------------------------

Syntax
WMDIChild{ [ <oParent> ] , [ <cTitle> ] , [ <cnMenuId> ] , [ <lCreate> ] }
             -->   SELF

Arguments
<oParent> optionally specifies the parent (owner) of the
window.  Just as <oParent> is the owner of self, the parent's
hWnd will be the actual owner of self's window (if it has a
window on the screen).  If this parameter is NIL, <lCreate> needs
to be FALSE (.F.), as an MDI child window must have the MDI client
as its parent.

<cTitle> specifies the caption for the title bar of the window
(if any) to be created.

<cnMenuId> is an optional menu id.  If it is a string, it is
taken to be the name of a resource menu.  If it is a number,
it is taken to be a menu handle.  The default (NIL) is to set
no menu.  Usually this is because you assign a menu after the
window has been created, normally as a result of the MENU
command.

<lCreate> specifies whether the window object's Create()
method is to be invoked immediately.  Usually you want the
default (.T.).

Returns
SELF.

Description
This method initialises an MDI child window object (a kind of frame
window).  By default, this will also create a window on the screen.

If you call the Init() method yourself, be sure to inform the
MDI client object using its CreateChild() method, or the
CreateChild() method in the WMDIFrame class.

Note: the order of <cTitle> and  <cnMenuId>  is the opposite
of that needed for WControlWindow's <nId> and <cTitle>,
reflecting the fact that <cnMenuId> and later parameters are
usually omitted for a frame window, whereas <nId> is usually
specified for controls and <cTitle> is not.

Example
// From SOURCE\OO\MDIWBROW.PRG:
CLASS MainWindow INHERIT WMDIFrame
     METHOD BrowseNew()                                          ;
            INLINE local cFile,                                   ;
                   cFile := GetOpenFileName(::hWnd, "*.dbf",      ;
                                            "Select a database"), ;
                   iif(cFile == nil, ,                            ;
                       ::CreateChild(Browser{::Client, cFile})),  ;
                   0
// . . .
ENDCLASS

CLASS Browser INHERIT WMDIChild
// . . .
     // Create() is here to automatically do more setup
     METHOD Create(oParent)                                       ;
            INLINE super:Create(oParent):MenuSetup():Browse()

     METHOD Init(oParent, cFile)                                  ;
            INLINE ::cFile := cFile,                              ;
                   super:Init(oParent)
// . . .
ENDCLASS


See Also: WMDIChild:Create() WMDIFrame WMDIClient

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson