home *** CD-ROM | disk | FTP | other *** search
- Type MyOptionButton From OptionButton
-
- ' METHODS for object: MyOptionButton
- Sub Click()
- Dim red, green, blue As Integer
-
- ' If there is no parent, then don't do anything
- If Not Parent Then Exit Sub
-
- red = rnd() * 255
- green = rnd() * 255
- blue = rnd() * 255
-
- Parent.lblColorDisplay.BackColor = RGB(red, green, blue)
-
- End Sub
-
- End Type
-
- Type ArrayOptBtnMasterForm From SampleMasterForm
- Dim lblColorDisplay As New Label
- Dim btnAdd As New Button
- Dim btnRemove As New Button
- Dim OptionCounter As Integer
- Dim MyOptionButton1 As New MyOptionButton
-
- ' METHODS for object: ArrayOptBtnMasterForm
- Sub btnAdd_Click()
- Dim name As String
- Dim o As Object
-
- If OptionCounter == 8 Then Exit Sub
-
- OptionCounter = OptionCounter + 1
-
- name = "MyOptionButton" & OptionCounter
- o = EmbedObject(ArrayOptBtnMasterForm, MyOptionButton, name)
-
- o.Caption = name
- o.Left = 1200
- o.Width = 2100
- o.Height = 300
-
-
- o.Top = 1200 + (OptionCounter * 300)
-
- End Sub
-
- Sub btnRemove_Click()
- Dim o As Object
- Dim name As String
-
- If OptionCounter == 1 Then Exit Sub
-
- name = "MyOptionButton" & OptionCounter
- o = FindEmbed(ArrayOptBtnMasterForm, name)
- DestroyObject(o)
-
- OptionCounter = OptionCounter - 1
-
- End Sub
-
- Sub ResetApplication_Click ()
- dim i as integer
- i = 0
- While i < Controls.Count
- If ((TypeOf Controls(i) Is MyOptionButton) && (Controls(i) <> MyOptionButton1)) Then
- DestroyObject(Controls(i))
- Else
- i = i + 1
- End If
- Wend
- OptionCounter = 1
- lblColorDisplay.BackColor = RGB(255, 255, 255)
-
- End Sub
-
- End Type
-
- Begin Code
- ' Reconstruction commands for object: MyOptionButton
- '
- With MyOptionButton
- .Move(0, 0, 0, 0)
- End With 'MyOptionButton
- ' Reconstruction commands for object: ArrayOptBtnMasterForm
- '
- With ArrayOptBtnMasterForm
- .Caption := "Option Button Array Demonstration"
- .Move(5295, 1365, 6105, 5055)
- .OptionCounter := 1
- .SampleDir := "W:\Examples\arrayopt\"
- .SampleName := "arrayopt"
- .DefaultButton := .btnAdd
- .CancelButton := .btnRemove
- With .lblColorDisplay
- .BackColor := 16777215
- .Move(300, 300, 5400, 900)
- .BorderStyle := "Fixed Single"
- End With 'ArrayOptBtnMasterForm.lblColorDisplay
- With .btnAdd
- .Caption := "&Add"
- .Move(4650, 1500, 1050, 450)
- End With 'ArrayOptBtnMasterForm.btnAdd
- With .btnRemove
- .Caption := "&Remove"
- .Move(4650, 2100, 1050, 450)
- End With 'ArrayOptBtnMasterForm.btnRemove
- With .MyOptionButton1
- .Caption := "MyOptionButton1"
- .Move(1200, 1500, 2100, 300)
- .TabStop := True
- .TabGroup := True
- .Value := True
- End With 'ArrayOptBtnMasterForm.MyOptionButton1
- With .helpfile
- .FileName := "W:\Examples\arrayopt\arrayopt.hlp"
- End With 'ArrayOptBtnMasterForm.helpfile
- End With 'ArrayOptBtnMasterForm
- End Code
-