home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 February / PCWK0297.iso / envelop / envelop.6 / Tools / Bootcamp / concepts / inherit / inherit.eto < prev    next >
Text File  |  1996-07-08  |  4KB  |  142 lines

  1. Type InheritanceForm From SampleMasterForm
  2.   Dim BtnCopyForm As New Button
  3.   Dim BtnDeleteForm As New Button
  4.   Dim Label1 As New Label
  5.   Dim Label2 As New Label
  6.   Dim Label3 As New Label
  7.   Dim Label4 As New Label
  8.   Dim Label5 As New Label
  9.   Dim Label6 As New Label
  10.   Dim Label7 As New Label
  11.   Dim Label8 As New Label
  12.   Dim Label9 As New Label
  13.   Dim Label10 As New Label
  14.  
  15.   ' METHODS for object: InheritanceForm
  16.   Sub BtnCopyForm_Click()
  17.     Dim unique_name As String
  18.     Dim new_form As Object
  19.   
  20.     unique_name = UniqueObjectName(InheritanceForm)
  21.     new_form = CopyObject(InheritanceForm, unique_name)
  22.   
  23.     new_form.Show
  24.     new_form.Move Left + (Width / 10), Top + (Height / 10), Width, Height
  25.     new_form.Caption = unique_name & " (Child)"
  26.   
  27.   End Sub
  28.  
  29.   Sub BtnDeleteForm_Click()
  30.     ' If the form is a copy of InheritanceForm, then destroy it
  31.     If Me = InheritanceForm Then 
  32.       ' Do nothing
  33.     Else 
  34.       DestroyObject(Me)
  35.     End If
  36.   End Sub
  37.  
  38.   Sub Load
  39.     SetSampleDir
  40.     InitHelpFile
  41.     If Me <> SampleMasterForm Then Show
  42.   End Sub
  43.  
  44.   Sub ResetApplication_Click
  45.     ' Remove a child form if it exists
  46.     If FindObject("InheritanceForm1") Then 
  47.       DestroyObject(InheritanceForm1)
  48.     End If
  49.     ' Remove any buttons that may be left on the form
  50.     If FindObject("InheritanceForm.Button1") Then 
  51.       DestroyObject(InheritanceForm.Button1)
  52.     End If
  53.     If FindObject("InheritanceForm.Button2") Then 
  54.       DestroyObject(InheritanceForm.Button2)
  55.     End If
  56.     If FindObject("InheritanceForm.Button3") Then 
  57.       DestroyObject(InheritanceForm.Button3)
  58.     End If
  59.   
  60.   End Sub
  61.  
  62. End Type
  63.  
  64. Begin Code
  65. ' Reconstruction commands for object: InheritanceForm
  66. '
  67.   With InheritanceForm
  68.     .Caption := "Inheritance Example (Parent)"
  69.     .Move(4320, 3915, 6765, 5490)
  70.     .SampleDir := "W:\bootcamp\concepts\inherit\"
  71.     .SampleName := "inherit"
  72.     With .BtnCopyForm
  73.       .Caption := "Copy Form"
  74.       .ZOrder := 1
  75.       .Move(150, 4200, 1350, 450)
  76.     End With  'InheritanceForm.BtnCopyForm
  77.     With .BtnDeleteForm
  78.       .Caption := "Delete Child"
  79.       .ZOrder := 2
  80.       .Move(4950, 4200, 1500, 450)
  81.     End With  'InheritanceForm.BtnDeleteForm
  82.     With .Label1
  83.       .Caption := "A. Click the Copy Form button on Parent to create Child form."
  84.       .ForeColor := 16711680
  85.       .ZOrder := 3
  86.       .Move(600, 450, 5850, 300)
  87.     End With  'InheritanceForm.Label1
  88.     With .Label2
  89.       .Caption := "B. Add a button located here on Parent.   ->"
  90.       .ForeColor := 16711680
  91.       .ZOrder := 4
  92.       .Move(600, 1200, 4200, 300)
  93.     End With  'InheritanceForm.Label2
  94.     With .Label3
  95.       .Caption := "C. Move the button down here on Parent. ->"
  96.       .ForeColor := 16711680
  97.       .ZOrder := 5
  98.       .Move(600, 1800, 4350, 300)
  99.     End With  'InheritanceForm.Label3
  100.     With .Label4
  101.       .Caption := "D. Add a button located here on Child.     ->"
  102.       .ForeColor := 255
  103.       .ZOrder := 6
  104.       .Move(600, 2550, 4350, 300)
  105.     End With  'InheritanceForm.Label4
  106.     With .Label5
  107.       .Caption := "E. Add a button located here on Parent.   ->"
  108.       .ForeColor := 16711680
  109.       .ZOrder := 7
  110.       .Move(600, 3300, 4200, 300)
  111.     End With  'InheritanceForm.Label5
  112.     With .Label6
  113.       .Caption := "1. Disable Form Editor on Parent form."
  114.       .ZOrder := 8
  115.       .Move(300, 150, 3750, 300)
  116.     End With  'InheritanceForm.Label6
  117.     With .Label7
  118.       .Caption := "2. Enable Form Editor on Parent."
  119.       .ZOrder := 9
  120.       .Move(300, 900, 3150, 300)
  121.     End With  'InheritanceForm.Label7
  122.     With .Label8
  123.       .Caption := "5. Click the 'Delete Child' button on Child form."
  124.       .ZOrder := 10
  125.       .Move(300, 3750, 4500, 300)
  126.     End With  'InheritanceForm.Label8
  127.     With .Label9
  128.       .Caption := "3. Enable Form Editor on Child."
  129.       .ZOrder := 11
  130.       .Move(300, 2250, 3150, 300)
  131.     End With  'InheritanceForm.Label9
  132.     With .Label10
  133.       .Caption := "4. Enable Form Editor on Parent."
  134.       .ZOrder := 12
  135.       .Move(300, 3000, 3150, 300)
  136.     End With  'InheritanceForm.Label10
  137.     With .helpfile
  138.       .FileName := "W:\bootcamp\concepts\inherit\inherit.hlp"
  139.     End With  'InheritanceForm.helpfile
  140.   End With  'InheritanceForm
  141. End Code
  142.