home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmAddIn
- BorderStyle = 3 'Fixed Dialog
- Caption = "Add New Property"
- ClientHeight = 4230
- ClientLeft = 2175
- ClientTop = 1935
- ClientWidth = 5490
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4230
- ScaleWidth = 5490
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 'CenterScreen
- Begin VB.CheckBox chkObject
- Caption = "It is an &Object"
- Height = 255
- Left = 120
- TabIndex = 6
- Top = 2280
- Width = 2175
- End
- Begin VB.Frame Frame2
- Caption = "Scope"
- Height = 1455
- Left = 2040
- TabIndex = 16
- Top = 2640
- Width = 1935
- Begin VB.OptionButton optScope
- Caption = "&Friend"
- Height = 255
- Index = 2
- Left = 240
- TabIndex = 12
- Top = 1080
- Width = 1095
- End
- Begin VB.OptionButton optScope
- Caption = "P&ublic"
- Height = 255
- Index = 1
- Left = 240
- TabIndex = 11
- Top = 720
- Value = -1 'True
- Width = 1095
- End
- Begin VB.OptionButton optScope
- Caption = "&Private"
- Height = 255
- Index = 0
- Left = 240
- TabIndex = 10
- Top = 360
- Width = 1095
- End
- End
- Begin VB.TextBox txtVariable
- Height = 315
- Left = 120
- TabIndex = 3
- Top = 1200
- Width = 3855
- End
- Begin VB.Frame Frame1
- Caption = "Property Procedures "
- Height = 1455
- Left = 120
- TabIndex = 15
- Top = 2640
- Width = 1815
- Begin VB.CheckBox chkSet
- Caption = "Property &Set"
- Enabled = 0 'False
- Height = 255
- Left = 240
- TabIndex = 9
- Top = 1080
- Width = 1455
- End
- Begin VB.CheckBox chkLet
- Caption = "Property &Let"
- Height = 255
- Left = 240
- TabIndex = 8
- Top = 720
- Value = 1 'Checked
- Width = 1455
- End
- Begin VB.CheckBox chkGet
- Caption = "Property &Get"
- Height = 255
- Left = 240
- TabIndex = 7
- Top = 360
- Value = 1 'Checked
- Width = 1455
- End
- End
- Begin VB.ComboBox cboDataType
- Height = 315
- ItemData = "frmAddIn.frx":0000
- Left = 120
- List = "frmAddIn.frx":0025
- TabIndex = 5
- Top = 1920
- Width = 3855
- End
- Begin VB.TextBox txtName
- Height = 315
- Left = 120
- TabIndex = 1
- Top = 480
- Width = 3855
- End
- Begin VB.CommandButton cmdCancel
- Cancel = -1 'True
- Caption = "Cancel"
- Height = 375
- Left = 4200
- TabIndex = 14
- Top = 3720
- Width = 1215
- End
- Begin VB.CommandButton cmdCopy
- Caption = "&Copy"
- Height = 375
- Left = 4200
- TabIndex = 13
- Top = 3240
- Width = 1215
- End
- Begin VB.Label Label1
- Caption = "&Member Variable"
- Height = 255
- Index = 2
- Left = 120
- TabIndex = 2
- Top = 960
- Width = 1455
- End
- Begin VB.Label Label1
- Caption = "&Data Type"
- Height = 255
- Index = 1
- Left = 120
- TabIndex = 4
- Top = 1680
- Width = 1455
- End
- Begin VB.Label Label1
- Caption = "&Name"
- Height = 255
- Index = 0
- Left = 120
- TabIndex = 0
- Top = 240
- Width = 1455
- End
- Attribute VB_Name = "frmAddIn"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' this is the standard prefix used to build Member variable names
- Const DEFAULT_PREFIX As String = "m_"
- ' this properties are filled by the Connect class
- Public Connect As Connect
- Public VBInstance As VBIDE.VBE
- Private Sub Form_Load()
- ' restore defaults
- txtVariable = DEFAULT_PREFIX
- cboDataType.Text = "String"
- End Sub
- Private Sub txtName_Change()
- ' build the name of the member variable
- txtVariable.Text = DEFAULT_PREFIX & txtName.Text
- End Sub
- Private Sub cboDataType_Click()
- ' delegate to the Change event
- Call cboDataType_Change
- End Sub
- Private Sub cboDataType_Change()
- ' enable or disable the "Property Set" checkbox according
- ' to which data type has been selected
- Select Case LCase$(cboDataType.Text)
- Case "integer", "long", "single", "double", "currency", "string", "date", "byte", "boolean"
- chkObject.Enabled = False
- Case "object"
- chkObject.Enabled = True
- chkObject.Value = vbChecked
- Case Else
- chkObject.Enabled = True
- End Select
- End Sub
- Private Sub chkObject_Click()
- chkSet.Enabled = chkObject.Value
- End Sub
- Private Sub cmdCopy_Click()
- Clipboard.Clear
- Clipboard.setText GeneratedCode
- Unload Me
- End Sub
- Private Sub cmdCancel_Click()
- Unload Me
- End Sub
- Private Function GeneratedCode() As String
- Dim codeText As String
- Dim scopeText As String
- Dim setText As String
- ' retrieve the scope
- If optScope(0).Value Then
- scopeText = "Private "
- ElseIf optScope(1).Value Then
- scopeText = "Public "
- Else
- scopeText = "Friend "
- End If
- ' should we use "set" when assigning?
- If chkObject.Enabled And chkObject.Value = vbChecked Then
- setText = "Set "
- End If
- ' create the declaration of the member variable
- codeText = "Private " & txtVariable & " As " & cboDataType & vbCrLf & vbCrLf
- ' add the Property Get code, if requested
- If chkGet.Value Then
- codeText = codeText & scopeText & "Property Get " & txtName & "() As " & cboDataType.Text & vbCrLf _
- & vbTab & setText & txtName & " = " & txtVariable & vbCrLf _
- & "End Property" & vbCrLf & vbCrLf
- End If
- ' add the Property Let code, if requested
- If chkLet.Value Then
- codeText = codeText & scopeText & "Property Let " & txtName & "(newValue As " & cboDataType.Text & ")" & vbCrLf _
- & vbTab & txtVariable & " = newValue" & vbCrLf _
- & "End Property" & vbCrLf & vbCrLf
- End If
- ' add the Property Let code, if requested
- If setText <> "" And chkSet.Value Then
- codeText = codeText & scopeText & "Property Set " & txtName & "(newValue As " & cboDataType.Text & ")" & vbCrLf _
- & vbTab & setText & txtVariable & " = newValue" & vbCrLf _
- & "End Property" & vbCrLf & vbCrLf
- End If
- GeneratedCode = codeText
- End Function
-