home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / guix01.zip / CHILDX.TXT < prev   
Text File  |  1994-01-26  |  3KB  |  97 lines

  1.  
  2. Guidelines Example 001.                      Guidelines Tech Support  26jan94
  3.  
  4. This example is released to demonstrate one or more techniques. No warranties 
  5. expressed or implied. (c) JBA 1994 - adapted from code by Greg Jones [JBA].
  6.  
  7.  
  8.               Multiple Child Windows under Guidelines              
  9.               ---------------------------------------
  10.  
  11.  
  12. The accompanying file, CHILDX.GUI is a simple example of a way to construct 
  13. multiple modeless child windows within a frame, giving a similar appearance 
  14. to an MDI application. It is compatible with Guidelines V2.0G and later.
  15.  
  16. There are only really three JOT rountines behind this, the Frame Create() and
  17. Size() methods do the work, and the "Arrange" menu click event handler which 
  18. simply calls the Size() method.
  19.  
  20. The JOT code is shown below:
  21.  
  22.  
  23.  
  24. VOID Frame1.Create ()
  25.     ; Load the child windows
  26.     Child1.Load (NullWindow)
  27.     Child2.Load (NullWindow)
  28.     Child3.Load (NullWindow)
  29.     
  30.     ; Set their parent to Frame1 so they are clipped to it
  31.     Child1.Parent = Frame1
  32.     Child2.Parent = Frame1
  33.     Child3.Parent = Frame1
  34.     
  35.     ; Activate them
  36.     Child2.Activate ()
  37.     Child3.Activate ()
  38.     Child1.Activate () ; activated last so it has active title.
  39.     
  40.     ; Cause them to be resized
  41.     Frame1.Size ()
  42. end
  43.  
  44.  
  45.  
  46. VOID Frame1.Size ()
  47.     LONG x, y, cx, cy
  48.     
  49.     Frame1.GetClientRect (x, y, cx, cy)
  50.     
  51.     ; Child 1 takes up the top half of the client
  52.     if Child1
  53.     then
  54.         Child1.XPos   = 0
  55.         Child1.YPos   = cy / 2
  56.         Child1.Height = cy / 2
  57.         Child1.Width  = cx
  58.     endif
  59.     
  60.     ; Child 2 takes up the left half of the bottom half of the client
  61.     if Child2
  62.     then
  63.         Child2.XPos   = 0
  64.         Child2.YPos   = 0
  65.         Child2.Height = cy / 2
  66.         Child2.Width  = cx / 2
  67.     endif
  68.     
  69.     ; Child 3 takes up the right half of the bottom half of the client
  70.     if Child3
  71.     then
  72.         Child3.XPos   = cx / 2
  73.         Child3.YPos   = 0
  74.         Child3.Height = cy / 2
  75.         Child3.Width  = cx / 2
  76.     endif
  77. end
  78.  
  79.  
  80. VOID Frame1.MenuItem4.Click ()
  81.     Frame1.Size()
  82. end
  83.  
  84.  
  85.  
  86.  
  87.  
  88. Please address any questions regarding either this sample, or the Guidelines 
  89. product in general to:
  90.  
  91.     Jon Wright - Guidelines Tech Support
  92.     CompuServe 100316,3353
  93.     Internet   100316.3353@compuserve.com
  94.  
  95. Preferably these should be posted in Section 1 of the OS2AVEN forum, although 
  96. direct email is accepted.
  97.