[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
    oWin := TMdiFrame():New( nTop, nLeft, nBottom, nRight, cTitle,;
                              nStyle, oMenu, oBrush, oIcon, nClrFore,; 
                              nClrBack, lvScroll, lhScroll, nMenuInfo,;
                              cborder, oParent )
-------------------------------------------------------------------------------

    DEFINE WINDOW <oWin> ;
           MDI ;
         [ FROM <nTop>, <nLeft> TO <nBottom>, <nRight> ] ;
         [ TITLE <cTitle> ] ;
         [ STYLE <nStyle> ] ;
         [ MENU <oMenu> ] ;
         [ BRUSH <oBrush> ] ;
         [ ICON  <oIcon> ] ;
         [ MENUINFO  <nMenInfo> ] ;
         [ OF <oParent> ] ;
         [ COLOR | COLORS <nClrFore> [,<nClrBack>] ];
         [ VSCROLL | VERTICAL SCROLL ] ;
         [ HSCROLL | HORIZONTAL SCROLL ]
         [ BORDER [ NONE | SINGLE ] ] ;



 PARAMETER:

   For a brief description of the standard Window Parameter please activate
   Related Topics:  and select  DEFINE WINDOW 


  <nMenInfo>       Is the Position of the PopUp Menue where Windows
                   reports the currently opened Child Windows. 
                   Hard to understand, eh ? 
                   Let's say we have created a MDI WIndow with one MDI Child,
                   like in the Example below. With the Clause MENUINFO 4 the
                   Title of our ChildWindow ( Mdi-Child ) would be displayed
                   like this ( The Window with Focus is checked ) :

                   --------------------------------------------
                      I AM THE MDI PARENT WINDOW               
                   --------------------------------------------
                     File   Tools   Windows   Help             
                   --------------------------------------------
                                          | Contents ..      |
                                          | About            |
                                          |------------------|
                                          |. 1 MDI Child     |
                                          +------------------+


 DESCRIPTION:

  This Command creates an MDI parent Window. I'm not going to explain
  Windows MDI Interface here ( refer to the Tutorial for this ), but
  there are some programming Aspects with MDI that you should know, or
  at least recall if you run into trouble.

  If you create a MDI Window, then in fact you create two Windows: 
  one 'standard' Window, called the MDI FRAME, and also a frameless and 
  therefore invisible Window, which is called the MDI Client.
  This Client Window is sized to the entire usable internal Area of the 
  MDI-Frame, think of it as a Window inside a Window. The MDI-Client has
  its own class ( the TMDIClient-Class ), and a reference to this Client
  Window is stored in the MDI-Frame's InstanceVar oWndClient.

  With this in mind, it is obviously that if you want to paint something
  on your Parent Windows internal Area, you have to paint it to the
  MDI-Client ! 
  Assume we have created a MDI parent oWin. Now you want to paint a Logo
  on this Window. Normally you would do it like this :

     +-------------------------------------------------------------+
     | @ 5, 5 BITMAP FILENAME "MyLogo.bmp" OF oWin                 |
     +-------------------------------------------------------------+

  which would result in an unvisible Logo, because if you write it to the 
  MDI-Frame your Logo is hidden behind the Client Window ! So a better
  approach is this:

     +-------------------------------------------------------------+
     | @ 5, 5 BITMAP FILENAME "MyLogo.bmp" OF oWin:oWndClient      |
     +-------------------------------------------------------------+

  Better, but still not good, because Windows MDI will treat your Bitmap
  as an Window itself ( remember, it's a control which is inherited from 
  a Window ! ). So if you tile or cascade the MDI-Childwindows, your nice
  little Logo will join the Band and gets tiled and cascaded just like the 
  rest.
  The solution to this is that you don't create a control but just paint the
  bitmap on the Client. You can do so, because the MDI-Client, like any 
  Window, receives all the Eventmessages and can launch the appropriate 
  Actions ( just like ACTIVATE oWin ON .. ). 

  Because we want to paint our Bitmap, we use the ON PAINT Slot 
  ( ::bPainted ) of the Client:

     +-------------------------------------------------------------+
     |  /* Draw a Bitmap on the MDI parent */                      |
     |  DEFINE BITMAP oBmp FILENAME "Logo.bmp"                     |
     |                                                             |
     |  oWin:oWndClient:bPainted :=                                |
     |    { | hDC | PalBmpDraw( hDC, 100, 100, oBmp:hBmpPal ) }    |
     +-------------------------------------------------------------+

  Now your Logo will be painted every time that the MDI-Client is repainted,
  and that is what we wanted ( the Pal functions and methods are explained 
  in the bitmap section )




 EXAMPLE:

     +-------------------------------------------------------------+
     |  /* Create MDI Parent Window */                             |
     |  DEFINE WINDOW oWin FROM 1,1 TO 20, 60 ;                    |
     |   TITLE "I am the MDI Parent Window" ;                      |
     |   MDI ;                                                     |
     |   MENU BuildMenu()                                          |
     |                                                             |
     |  /* Use the MessageBar */                                   |
     |  SET MESSAGE OF oWin TO "Main Window"                       |
     |                                                             |
     |  /* Create MDI ChildWindow */                               |
     |  DEFINE WINDOW oWinEdit MDICHILD OF oWin ;                  |
     |   FROM 2,2 TO 20,50 ;                                       |
     |   TITLE "MDI Child" ;                                       |
     |   COLOR "W+/W"                                              |
     |                                                             |
     |  @ 4,2 GET cName OF oWinEdit SIZE 170,25 COLOR "BG/W"       |
     |  [ ... ]                                                    |
     +-------------------------------------------------------------+



See Also: DEFINE WINDOW .. DEFINE WINDOW MDICHILD ACTIVATE WINDOW oWndClient
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson