home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD175623252001.psc / FrmEdit.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-03-25  |  7.5 KB  |  191 lines

  1. VERSION 5.00
  2. Begin VB.Form FrmEdit 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Edit AI Properties"
  5.    ClientHeight    =   3780
  6.    ClientLeft      =   45
  7.    ClientTop       =   285
  8.    ClientWidth     =   4680
  9.    LinkTopic       =   "Form2"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   3780
  13.    ScaleWidth      =   4680
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   3  'Windows Default
  16.    Begin VB.Frame Frame2 
  17.       Caption         =   "Frame2"
  18.       Height          =   975
  19.       Left            =   0
  20.       TabIndex        =   5
  21.       Top             =   0
  22.       Width           =   4695
  23.       Begin VB.CommandButton Update 
  24.          Caption         =   "Add / Update"
  25.          Height          =   615
  26.          Left            =   3840
  27.          TabIndex        =   8
  28.          Top             =   240
  29.          Width           =   735
  30.       End
  31.       Begin VB.TextBox OutputTxt 
  32.          Height          =   285
  33.          Left            =   840
  34.          TabIndex        =   7
  35.          Top             =   600
  36.          Width           =   2895
  37.       End
  38.       Begin VB.TextBox InputTxt 
  39.          Height          =   285
  40.          Left            =   840
  41.          TabIndex        =   6
  42.          Top             =   240
  43.          Width           =   2895
  44.       End
  45.       Begin VB.Label Label2 
  46.          Alignment       =   2  'Center
  47.          Caption         =   "Output:"
  48.          Height          =   255
  49.          Left            =   120
  50.          TabIndex        =   10
  51.          Top             =   600
  52.          Width           =   735
  53.       End
  54.       Begin VB.Label Label1 
  55.          Alignment       =   2  'Center
  56.          Caption         =   "Input:"
  57.          Height          =   255
  58.          Left            =   120
  59.          TabIndex        =   9
  60.          Top             =   240
  61.          Width           =   615
  62.       End
  63.    End
  64.    Begin VB.Frame Frame1 
  65.       Caption         =   "AI Inputs and Outputs (Double Click an Entry to delete it)"
  66.       Height          =   2175
  67.       Left            =   0
  68.       TabIndex        =   2
  69.       Top             =   1080
  70.       Width           =   4695
  71.       Begin VB.ListBox AiInputs 
  72.          Height          =   1815
  73.          ItemData        =   "FrmEdit.frx":0000
  74.          Left            =   120
  75.          List            =   "FrmEdit.frx":0002
  76.          TabIndex        =   4
  77.          Top             =   240
  78.          Width           =   2175
  79.       End
  80.       Begin VB.ListBox AiOutputs 
  81.          Height          =   1815
  82.          ItemData        =   "FrmEdit.frx":0004
  83.          Left            =   2400
  84.          List            =   "FrmEdit.frx":0006
  85.          TabIndex        =   3
  86.          Top             =   240
  87.          Width           =   2175
  88.       End
  89.    End
  90.    Begin VB.CommandButton Cancel 
  91.       Caption         =   "&Cancel"
  92.       Height          =   375
  93.       Left            =   2520
  94.       TabIndex        =   1
  95.       Top             =   3360
  96.       Width           =   1215
  97.    End
  98.    Begin VB.CommandButton OK 
  99.       Caption         =   "&Ok"
  100.       Height          =   375
  101.       Left            =   1080
  102.       TabIndex        =   0
  103.       Top             =   3360
  104.       Width           =   1215
  105.    End
  106. Attribute VB_Name = "FrmEdit"
  107. Attribute VB_GlobalNameSpace = False
  108. Attribute VB_Creatable = False
  109. Attribute VB_PredeclaredId = True
  110. Attribute VB_Exposed = False
  111. Option Explicit
  112. Private Sub AiInputs_Click()
  113. 'Match up the listfocuses so that we can visually see which statement goes with which response.
  114. AiOutputs.ListIndex = AiInputs.ListIndex
  115. 'Fill the statement/resposne textboxes with the selected entry, just in case someone wants to easily modify it.
  116. InputTxt.Text = AiInputs.List(AiInputs.ListIndex)
  117. OutputTxt.Text = AiOutputs.List(AiOutputs.ListIndex)
  118. End Sub
  119. Private Sub AiInputs_DblClick()
  120. 'Delete the entries in the lists, because after all, thats why the list was double clicked.
  121. AiOutputs.RemoveItem AiInputs.ListIndex
  122. AiInputs.RemoveItem AiInputs.ListIndex
  123. 'Clean out the textboxes just in case the double clicking caused them to be filled with the now deleted data.
  124. InputTxt.Text = ""
  125. OutputTxt.Text = ""
  126. End Sub
  127. Private Sub AiOutputs_Click()
  128. 'Match up the listfocuses so that we can visually see which statement goes with which response.
  129. AiInputs.ListIndex = AiOutputs.ListIndex
  130. 'Fill the statement/resposne textboxes with the selected entry, just in case someone wants to easily modify it.
  131. InputTxt.Text = AiInputs.List(AiInputs.ListIndex)
  132. OutputTxt.Text = AiOutputs.List(AiOutputs.ListIndex)
  133. End Sub
  134. Private Sub AiOutputs_DblClick()
  135. 'Delete the entries in the lists, because after all, thats why the list was double clicked.
  136. AiInputs.RemoveItem AiOutputs.ListIndex
  137. AiOutputs.RemoveItem AiOutputs.ListIndex
  138. 'Clean out the textboxes just in case the double clicking caused them to be filled with the now deleted data.
  139. InputTxt.Text = ""
  140. OutputTxt.Text = ""
  141. End Sub
  142. Private Sub OK_Click()
  143. Dim Counter As Long
  144. 'Clear the unit's lists so that there is no repeat data in the unit, which allows for potential errors
  145. FrmMain.AiUnit1.DumpLists
  146. 'Refill the AIUnit's statement/response lists with the lists that are contained within the edit form.
  147. For Counter = 0 To (AiInputs.ListCount - 1)
  148.  FrmMain.AiUnit1.AddStatement AiInputs.List(Counter), AiOutputs.List(Counter)
  149. Next Counter
  150. 'Unload the form. We must use the unload insted of hide, otherwise when the form is reloaded, the listboxes will not be updated
  151. Unload Me
  152. End Sub
  153. Private Sub Cancel_Click()
  154. 'Unload the form. We must use the unload insted of hide, otherwise when the form is reloaded, the listboxes will not be updated
  155. Unload Me
  156. End Sub
  157. Private Sub Form_Load()
  158. Dim Statements As AIStatement, Counter As Long
  159. 'clear out the listboxes so that there will not be repeat data in them, which could cause an error.
  160. AiInputs.Clear
  161. AiOutputs.Clear
  162. 'Fill in The two list boxes with the Statement/Response data that is retireved from the unit's internal lists.
  163. For Counter = 0 To (FrmMain.AiUnit1.StatementAmount - 1)
  164.  Statements = FrmMain.AiUnit1.GetStatement(Counter)
  165.  AiInputs.AddItem Statements.Input
  166.  AiOutputs.AddItem Statements.Response
  167. End Sub
  168. Private Sub Update_Click()
  169. Dim Index As Long
  170. 'First, Check to make sure that Both the Statement and Response fields are filled in
  171. If InputTxt.Text > "" And OutputTxt.Text > "" Then
  172.  'Run through the Statement List to make sure that the Newly Input Statement isnt already there
  173.  For Index = 0 To (AiInputs.ListCount - 1)
  174.   'We use the CleanUpThisMess Statement here to ensure that input statement isnt just a rework of a previous one
  175.   If FrmMain.AiUnit1.CleanUpThisMess(InputTxt.Text) = AiInputs.List(Index) Then Exit For
  176.  Next
  177.  'At this point the the previous entry in the lists is overwritten if one was alreadyt found
  178.  'If the previous loop did not find the statement, then this will just add the new statement to the end of the lists
  179.  AiInputs.List(Index) = FrmMain.AiUnit1.CleanUpThisMess(InputTxt.Text)
  180.  AiOutputs.List(Index) = OutputTxt.Text
  181.  'Empty the textboxes and set foceus to the Statement box, just for cosmetic purposes
  182.  InputTxt.Text = ""
  183.  OutputTxt.Text = ""
  184.  InputTxt.SetFocus
  185.  'in case one of the earlier text boxes was not filled in, display and error, and set focus to the appropriate box.
  186.  MsgBox "Enter both a valid Input and Output statement."
  187.  If InputTxt.Text = "" Then InputTxt.SetFocus
  188.  If OutputTxt.Text = "" Then OutputTxt.SetFocus
  189. End If
  190. End Sub
  191.