home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 February
/
Chip_2002-02_cd1.bin
/
zkuste
/
vbasic
/
Data
/
Utility
/
PropWiz.exe
/
Dev
/
PropertyAddIn
/
AddIn.frm
< prev
next >
Wrap
Text File
|
2000-01-27
|
7KB
|
248 lines
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx"
Begin VB.Form frmAddIn
BorderStyle = 3 'Fixed Dialog
Caption = "Property Wizard"
ClientHeight = 4335
ClientLeft = 2175
ClientTop = 1935
ClientWidth = 8145
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4335
ScaleWidth = 8145
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdRefresh
Caption = "&Refresh"
Height = 315
Left = 4380
TabIndex = 2
ToolTipText = "Search for all Controls with this property"
Top = 120
Width = 975
End
Begin VB.TextBox txtProperty
Height = 315
Left = 1140
TabIndex = 1
Text = "TooltipText"
ToolTipText = "The property to search for"
Top = 120
Width = 3075
End
Begin VB.TextBox txtValue
Height = 285
Left = 1020
TabIndex = 4
ToolTipText = "The new value to assign to the property"
Top = 3540
Width = 6975
End
Begin ComctlLib.ListView lvwCtrls
Height = 3015
Left = 120
TabIndex = 3
ToolTipText = "A list of all controls which have this property"
Top = 480
Width = 7875
_ExtentX = 13891
_ExtentY = 5318
View = 3
Sorted = -1 'True
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 327682
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 3
BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
Key = ""
Object.Tag = ""
Text = "Control"
Object.Width = 4410
EndProperty
BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
SubItemIndex = 1
Key = ""
Object.Tag = ""
Text = "Caption"
Object.Width = 3528
EndProperty
BeginProperty ColumnHeader(3) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
SubItemIndex = 2
Key = ""
Object.Tag = ""
Text = "Property Value"
Object.Width = 15875
EndProperty
End
Begin VB.CommandButton cmdClose
Cancel = -1 'True
Caption = "Close"
Height = 375
Left = 6780
TabIndex = 6
ToolTipText = "Hide the form"
Top = 3900
Width = 1215
End
Begin VB.Label Label2
Caption = "&Property"
Height = 255
Left = 180
TabIndex = 0
Top = 120
Width = 1155
End
Begin VB.Label Label1
Caption = "&New Value="
Height = 195
Left = 120
TabIndex = 5
Top = 3600
Width = 915
End
End
Attribute VB_Name = "frmAddIn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public VBInstance As VBIDE.VBE
Public Connect As Connect
Private m_Component As VBComponent
Private Sub cmdClose_Click()
8 On Error GoTo ErrorHandler
10 Connect.Hide
11 Exit Sub
13 ErrorHandler:
14 MsgBox "frmAddIn.CancelButton_Click Line=" & Erl & vbCrLf & Err.Description
End Sub
Public Function Create() As Boolean
18 On Error GoTo ErrorHandler
20 Dim Ctrl As VBControl
24 If VBInstance.SelectedVBComponent Is Nothing Then
25 Create = False
26 Exit Function
27 End If
29 Set m_Component = VBInstance.SelectedVBComponent
31 Select Case m_Component.Type
Case vbext_ct_PropPage, _
vbext_ct_UserControl, _
vbext_ct_VBForm, _
vbext_ct_VBMDIForm, _
vbext_ct_MSForm
38 Case Else
39 Exit Function
40 End Select
42 Create = True
44 Call LoadData
46 Exit Function
48 ErrorHandler:
49 MsgBox "frmAddIn.Create Line=" & Erl & vbCrLf & Err.Description
End Function
Private Sub OKButton_Click()
53 On Error GoTo ErrorHandler
55 MsgBox "AddIn operation on: " & VBInstance.FullName
56 Exit Sub
58 ErrorHandler:
59 MsgBox "frmAddIn.OKButton_Click Line=" & Erl & vbCrLf & Err.Description
End Sub
Public Sub AddControl(Ctrl As VBControl)
63 Dim LI As ListItem
64 Dim strValue As String
66 On Error GoTo ErrorHandler
68 strValue = Ctrl.Properties(txtProperty.Text)
70 Set LI = lvwCtrls.ListItems.Add(Key:="K" & Ctrl.Properties!Name, Text:=Ctrl.Properties!Name)
71 On Error Resume Next
999 LI.SubItems(1) = Ctrl.Properties("Caption")
73 If Err <> 0 Then LI.SubItems(1) = Ctrl.Properties("LabelCaption")
74 LI.SubItems(2) = strValue
79 Exit Sub
81 ErrorHandler:
82 Exit Sub
End Sub
Private Sub cmdRefresh_Click()
Call LoadData
End Sub
Private Sub lvwCtrls_ItemClick(ByVal Item As ComctlLib.ListItem)
88 On Error GoTo ErrorHandler
90 txtValue.Text = Item.SubItems(2)
92 Exit Sub
94 ErrorHandler:
95 MsgBox "frmAddIn.lvwCtrls_ItemClick Line=" & Erl & vbCrLf & Err.Description
End Sub
Private Sub SaveValue()
107 On Error GoTo ErrorHandler
108 Dim Item As ListItem
110 Set Item = lvwCtrls.SelectedItem
111 If Item Is Nothing Then Exit Sub
113 Item.SubItems(2) = txtValue.Text
114 m_Component.Designer.VBControls(Item.Text).Properties(txtProperty.Text) = txtValue.Text
116 Exit Sub
118 ErrorHandler:
119 On Error Resume Next
Item.SubItems(2) = m_Component.Designer.VBControls(Item.Text).Properties(txtProperty.Text)
Exit Sub
End Sub
Private Sub LoadData()
123 On Error GoTo ErrorHandler
124 Dim VBCtrl As VBControl
125 lvwCtrls.ListItems.Clear
126 txtValue.Text = ""
127 For Each VBCtrl In m_Component.Designer.VBControls
128 Call AddControl(VBCtrl)
129 Next VBCtrl
Exit Sub
131 ErrorHandler:
132 MsgBox "frmAddIn.LoadData Line=" & Erl & vbCrLf & Err.Description
End Sub
Private Sub txtValue_Validate(Cancel As Boolean)
SaveValue
End Sub