home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / das_buch / windows / mdi / gen_mdi3.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-06-04  |  1.7 KB  |  69 lines

  1. PROGRAM Gen_MDI3;
  2.  
  3. USES WinTypes, WinProcs, OWindows;
  4.  
  5. {$R Gen_MDI3.RES}
  6.  
  7. CONST
  8.   cm_CreateChild1 = 101;
  9.   cm_CreateChild2 = 102;
  10.  
  11. TYPE
  12.   tMyApplication = OBJECT(tApplication)
  13.     PROCEDURE InitMainWindow; VIRTUAL;
  14.   END;
  15.  
  16.   pMyMDIWindow = ^tMyMDIWindow;
  17.   tMyMDIWindow = OBJECT(tMDIWindow)
  18.     FUNCTION cmCreateChild1: pWindowsObject;
  19.              VIRTUAL cm_First + cm_CreateChild1;
  20.     FUNCTION cmCreateChild2: pWindowsObject;
  21.              VIRTUAL cm_First + cm_CreateChild2;
  22.   END;
  23.  
  24.   pMyChild1 = ^tMyChild1;
  25.   tMyChild1 = OBJECT(tWindow)
  26.     PROCEDURE Paint(PaintDC: hDC; VAR PaintInfo: tPaintStruct); VIRTUAL;
  27.   END;
  28.  
  29.   pMyChild2 = ^tMyChild2;
  30.   tMyChild2 = OBJECT(tWindow)
  31.     PROCEDURE Paint(PaintDC: hDC; VAR PaintInfo: tPaintStruct); VIRTUAL;
  32.   END;
  33.  
  34. PROCEDURE tMyChild1.Paint(PaintDC: hDC; VAR PaintInfo: tPaintStruct);
  35. BEGIN
  36.   Rectangle(PaintDC, 10, 10, 100, 100);
  37. END;
  38.  
  39. PROCEDURE tMyChild2.Paint(PaintDC: hDC; VAR PaintInfo: tPaintStruct);
  40. BEGIN
  41.   Ellipse(PaintDC, 10, 10, 100, 100);
  42. END;
  43.  
  44. FUNCTION tMyMDIWindow.cmCreateChild1: pWindowsObject;
  45. BEGIN
  46.   cmCreateChild1 := Application^.MakeWindow(New(pMyChild1,
  47.                               Init(@Self, 'First MDI Child')));
  48. END;
  49.  
  50. FUNCTION tMyMDIWindow.cmCreateChild2: pWindowsObject;
  51. BEGIN
  52.   cmCreateChild2 := Application^.MakeWindow(New(pMyChild2,
  53.                               Init(@Self, 'Second MDI Child')));
  54. END;
  55.  
  56. PROCEDURE tMyApplication.InitMainWindow;
  57. BEGIN
  58.   MainWindow := New(pMyMDIWindow, Init('MDI Test Program 3',LoadMenu(hInstance, 'Generic')));
  59. END;
  60.  
  61. VAR
  62.   MyApp : tMyApplication;
  63.  
  64. BEGIN
  65.   MyApp.Init('MyProgram');
  66.   MyApp.Run;
  67.   MyApp.Done;
  68. END.
  69.