home *** CD-ROM | disk | FTP | other *** search
/ On Hand / On_Hand_From_Softbank_1994_Release_2_Disc_2_1994.iso / 00202 / s / disk1 / array.fr_ / array.bin
Text File  |  1993-04-28  |  3KB  |  101 lines

  1. VERSION 2.00
  2. Begin Form frmControlArray 
  3.    Caption         =   "Control Array Example"
  4.    Height          =   6840
  5.    Left            =   1020
  6.    LinkTopic       =   "Form1"
  7.    ScaleHeight     =   6435
  8.    ScaleWidth      =   6075
  9.    Top             =   270
  10.    Width           =   6195
  11.    Begin CommandButton cmdClose 
  12.       Caption         =   "&Close"
  13.       Height          =   495
  14.       Left            =   3960
  15.       TabIndex        =   5
  16.       Top             =   4440
  17.       Width           =   1215
  18.    End
  19.    Begin PictureBox picDisplay 
  20.       Height          =   1215
  21.       Left            =   600
  22.       ScaleHeight     =   1185
  23.       ScaleWidth      =   4905
  24.       TabIndex        =   4
  25.       Top             =   360
  26.       Width           =   4935
  27.    End
  28.    Begin CommandButton cmdDelete 
  29.       Caption         =   "&Delete"
  30.       Height          =   495
  31.       Left            =   3960
  32.       TabIndex        =   3
  33.       Top             =   3120
  34.       Width           =   1215
  35.    End
  36.    Begin CommandButton cmdAdd 
  37.       Caption         =   "&Add"
  38.       Height          =   495
  39.       Left            =   3960
  40.       TabIndex        =   2
  41.       Top             =   2355
  42.       Width           =   1215
  43.    End
  44.    Begin OptionButton optButton 
  45.       Caption         =   "Option2"
  46.       Height          =   495
  47.       Index           =   1
  48.       Left            =   960
  49.       TabIndex        =   1
  50.       Top             =   2640
  51.       Width           =   1215
  52.    End
  53.    Begin OptionButton optButton 
  54.       Caption         =   "Option1"
  55.       Height          =   495
  56.       Index           =   0
  57.       Left            =   960
  58.       TabIndex        =   0
  59.       Top             =   2235
  60.       Width           =   1215
  61.    End
  62.    Begin Label lblColor 
  63.       Caption         =   "Select an option button to display a new color."
  64.       Height          =   495
  65.       Left            =   600
  66.       TabIndex        =   6
  67.       Top             =   1800
  68.       Width           =   3015
  69.    End
  70. End
  71. Dim MaxId As Integer
  72.  
  73. Sub cmdAdd_Click ()
  74.     If MaxId = 0 Then MaxId = 1     ' Set total option buttons.
  75.     If MaxId > 8 Then Exit Sub      ' Only ten buttons allowed.
  76.     MaxId = MaxId + 1               ' Increment button count.
  77.     Load OptButton(MaxId)           ' Create new button.
  78.     OptButton(0).SetFocus           ' Reset button selection.
  79.     ' Set new button under previous button.
  80.     OptButton(MaxId).Top = OptButton(MaxId - 1).Top + 400
  81.     OptButton(MaxId).Visible = True    ' Display new button.
  82.     OptButton(MaxId).Caption = "Option" & MaxId + 1
  83. End Sub
  84.  
  85. Sub cmdClose_Click ()
  86.    Unload Me    ' Unload this form.
  87. End Sub
  88.  
  89. Sub cmdDelete_Click ()
  90.     If MaxId = 1 Then Exit Sub      ' Keep first two buttons.
  91.     Unload OptButton(MaxId)         ' Delete last button.
  92.     MaxId = MaxId - 1               ' Decrement button count.
  93.     OptButton(0).SetFocus           ' Reset button selection.
  94. End Sub
  95.  
  96. Sub optButton_Click (Index As Integer)
  97. ' Index indicates the control in the control array that was clicked.
  98.     picDisplay.BackColor = QBColor(Index + 1)
  99. End Sub
  100.  
  101.