VERSION 5.00 Begin VB.Form frmObject Caption = "New Object" ClientHeight = 7740 ClientLeft = 60 ClientTop = 345 ClientWidth = 10755 Icon = "frmObject.frx":0000 LinkTopic = "Form1" ScaleHeight = 7740 ScaleWidth = 10755 StartUpPosition = 1 'CenterOwner Begin VB.CommandButton cbCopyCode Caption = "Co&py Code" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 345 Left = 7560 TabIndex = 23 Top = 3195 Width = 3135 End Begin VB.CommandButton cbCancel Caption = "&Cancel" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 345 Left = 7560 TabIndex = 22 Top = 1245 Width = 3135 End Begin VB.CommandButton cbSave Caption = "&Save New Object" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 345 Left = 7560 TabIndex = 21 Top = 810 Width = 3135 End Begin VB.TextBox txtSpaceNumber Height = 300 Left = 7545 TabIndex = 19 Top = 255 Width = 1485 End Begin VB.ListBox lbNames Height = 1035 ItemData = "frmObject.frx":000C Left = 3915 List = "frmObject.frx":000E TabIndex = 18 TabStop = 0 'False Top = 1245 Width = 3525 End Begin VB.ListBox lbAttributes Height = 3765 ItemData = "frmObject.frx":0010 Left = 120 List = "frmObject.frx":0012 MultiSelect = 1 'Simple TabIndex = 6 Top = 3810 Width = 1605 End Begin VB.CommandButton cbDeleteName Caption = "&Delete" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 2700 TabIndex = 4 Top = 1755 Width = 1095 End Begin VB.CommandButton cbAddName Caption = "&Add" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 2700 TabIndex = 3 Top = 1395 Width = 1095 End Begin VB.TextBox txtName Height = 330 Left = 120 TabIndex = 2 Top = 1590 Width = 2475 End Begin VB.TextBox txtDescription Height = 1140 Left = 120 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 5 Top = 2400 Width = 7320 End Begin VB.TextBox txtInform BeginProperty Font Name = "Courier New" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 3780 Left = 1770 MultiLine = -1 'True ScrollBars = 2 'Vertical TabIndex = 13 TabStop = 0 'False Top = 3810 Width = 8910 End Begin VB.TextBox txtShortName Height = 330 Left = 3840 TabIndex = 1 Top = 810 Width = 3600 End Begin VB.ComboBox lbParent Height = 315 Left = 3840 TabIndex = 10 TabStop = 0 'False Top = 240 Width = 3600 End Begin VB.ComboBox lbOfClass Height = 315 Left = 120 TabIndex = 8 TabStop = 0 'False Top = 255 Width = 3600 End Begin VB.TextBox txtObjectName Height = 330 Left = 120 TabIndex = 0 Top = 810 Width = 3600 End Begin VB.Label Label9 Caption = "Space Number" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 7575 TabIndex = 20 Top = 45 Width = 1425 End Begin VB.Label Label8 Caption = "Attributes" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 210 Left = 150 TabIndex = 17 Top = 3600 Width = 1110 End Begin VB.Label Label7 Caption = "name Property" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 150 TabIndex = 16 Top = 1365 Width = 1605 End Begin VB.Label Label6 Caption = "description Property" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 210 Left = 150 TabIndex = 15 Top = 2190 Width = 2070 End Begin VB.Label Label5 Caption = "Inform Code" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 1845 TabIndex = 14 Top = 3600 Width = 1815 End Begin VB.Label Label4 Caption = "short_name Property" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 3855 TabIndex = 12 Top = 600 Width = 2175 End Begin VB.Label Label3 Caption = "Parent" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 3885 TabIndex = 11 Top = 45 Width = 1815 End Begin VB.Label Label2 Caption = "Of Class" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 165 TabIndex = 9 Top = 60 Width = 1815 End Begin VB.Label Label1 Caption = "Object Name" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 135 TabIndex = 7 Top = 600 Width = 1815 End End Attribute VB_Name = "frmObject" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub cbAddName_Click() Dim wd As Integer With frmObject If .txtName = "" Then Exit Sub If .lbNames.ListCount > 0 Then For wd = 0 To .lbNames.ListCount - 1 If .lbNames.List(wd) = .txtName Then MsgBox "The name is already in the 'name' list.", , "Add name" Exit Sub End If Next wd End If .lbNames.AddItem .txtName .txtName.Text = "" .txtName.SetFocus End With DrawObjectCode End Sub Private Sub cbCancel_Click() Unload Me End Sub Private Sub cbCopyCode_Click() With frmObject Clipboard.SetText .txtInform End With End Sub Private Sub cbDeleteName_Click() Dim wd As Integer With frmObject If .lbNames.ListCount = 0 Then MsgBox "List is empty", , "Delete name" Exit Sub End If If .lbNames.SelCount = 0 Then MsgBox "Select a name to delete", , "Delete name" Exit Sub End If Do Until .lbNames.SelCount = 0 For wd = 0 To .lbNames.ListCount - 1 If .lbNames.Selected(wd) Then .lbNames.RemoveItem (wd) Exit For End If Next wd Loop End With DrawObjectCode End Sub Private Sub cbSave_Click() Dim rs As ADODB.Recordset Dim strSQL As String Dim strSQLValues As String 'On Error GoTo errorHandler With frmObject ' ' Add object ' strSQL = "INSERT INTO Object (ObjectName," strSQLValues = " Values ('" & .txtObjectName & "'," If .lbOfClass.ListIndex <> -1 Then strSQL = strSQL & "OfClassId," strSQLValues = strSQLValues & .lbOfClass.Text & "," End If If .lbParent.ListIndex <> -1 Then strSQL = strSQL & "ParentId," strSQLValues = strSQLValues & .lbParent.Text & "," End If If .txtSpaceNumber.Text <> "" Then strSQL = strSQL & "SpaceNumber " strSQLValues = strSQLValues & .txtSpaceNumber.Text & " " End If strSQL = Left(strSQL, Len(strSQL) - 1) & ")" strSQLValues = Left(strSQLValues, Len(strSQLValues) - 1) & ")" strSQL = strSQL & strSQLValues dbConn.Execute strSQL ' ' Get new ObjectId ' ' ' Add properties ' ' ' Add Attributes ' End With errorHandler: End Sub Private Sub Form_Load() 'GetClassList frmObject.lbOfClass 'GetParentList frmObject.lbParent 'GetAttributeList frmObject.lbAttributes End Sub Sub DrawObjectCode() Dim strCode As String Dim w As Integer Dim endComma As Boolean With frmObject ' ' Class or Object? ' If .lbOfClass.Text <> "" Then strCode = .lbOfClass.Text & " " Else strCode = "Object " End If ' ' Is object name defined yet? ' If .txtObjectName.Text = "" Then strCode = strCode & "object_name " Else strCode = strCode & .txtObjectName.Text & " " End If ' ' Is short_name property defined? ' If .txtShortName.Text <> "" Then strCode = strCode & Chr(34) & .txtShortName.Text & Chr(34) End If ' ' New line and a tab (in spaces) ' If .lbNames.ListCount > 0 Or .txtDescription.Text <> "" Or .lbAttributes.SelCount > 0 Then strCode = strCode & vbCrLf & Tabs(1) End If ' ' If any of the properties are set, add "with" ' endComma = False If .lbNames.ListCount > 0 Or .txtDescription.Text <> "" Then strCode = strCode & "with " If .lbNames.ListCount > 0 Then strCode = strCode & "name " For w = 0 To .lbNames.ListCount - 1 strCode = strCode & "'" & .lbNames.List(w) & "' " Next w strCode = Left(strCode, Len(strCode) - 1) strCode = strCode & "," endComma = True End If If .txtDescription <> "" Then If endComma Then strCode = strCode & vbCrLf & Tabs(1) End If strCode = strCode & "description" & vbCrLf strCode = strCode & QuoteBlock(.txtDescription, 1) & "," endComma = True End If End If ' ' Attributes... ' If .lbAttributes.SelCount > 0 Then If endComma Then strCode = strCode & vbCrLf & Tabs(1) End If strCode = strCode & "has " For w = 0 To .lbAttributes.ListCount - 1 If .lbAttributes.Selected(w) Then strCode = strCode & .lbAttributes.List(w) & " " End If Next w strCode = Left(strCode, Len(strCode) - 1) Else If endComma Then strCode = Left(strCode, Len(strCode) - 1) End If End If .txtInform = strCode & ";" End With End Sub Private Sub lbAttributes_Click() DrawObjectCode End Sub Private Sub lbOfClass_Change() DrawObjectCode End Sub Private Sub lbParent_Change() DrawObjectCode End Sub Private Sub txtDescription_Change() DrawObjectCode End Sub Private Sub txtInform_Click() MsgBox "This is a display area only. Click the 'COPY CODE' button to copy the code to the clipboard", , "Inform Code" frmObject.txtDescription.SetFocus Exit Sub End Sub Private Sub txtName_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cbAddName_Click End If End Sub Private Sub txtObjectName_Change() DrawObjectCode End Sub Private Sub txtShortName_Change() DrawObjectCode End Sub