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 >
Text File  |  2000-01-27  |  7KB  |  248 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx"
  3. Begin VB.Form frmAddIn 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Property Wizard"
  6.    ClientHeight    =   4335
  7.    ClientLeft      =   2175
  8.    ClientTop       =   1935
  9.    ClientWidth     =   8145
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   4335
  14.    ScaleWidth      =   8145
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin VB.CommandButton cmdRefresh 
  18.       Caption         =   "&Refresh"
  19.       Height          =   315
  20.       Left            =   4380
  21.       TabIndex        =   2
  22.       ToolTipText     =   "Search for all Controls with this property"
  23.       Top             =   120
  24.       Width           =   975
  25.    End
  26.    Begin VB.TextBox txtProperty 
  27.       Height          =   315
  28.       Left            =   1140
  29.       TabIndex        =   1
  30.       Text            =   "TooltipText"
  31.       ToolTipText     =   "The property to search for"
  32.       Top             =   120
  33.       Width           =   3075
  34.    End
  35.    Begin VB.TextBox txtValue 
  36.       Height          =   285
  37.       Left            =   1020
  38.       TabIndex        =   4
  39.       ToolTipText     =   "The new value to assign to the property"
  40.       Top             =   3540
  41.       Width           =   6975
  42.    End
  43.    Begin ComctlLib.ListView lvwCtrls 
  44.       Height          =   3015
  45.       Left            =   120
  46.       TabIndex        =   3
  47.       ToolTipText     =   "A list of all controls which have this property"
  48.       Top             =   480
  49.       Width           =   7875
  50.       _ExtentX        =   13891
  51.       _ExtentY        =   5318
  52.       View            =   3
  53.       Sorted          =   -1  'True
  54.       LabelWrap       =   -1  'True
  55.       HideSelection   =   -1  'True
  56.       _Version        =   327682
  57.       ForeColor       =   -2147483640
  58.       BackColor       =   -2147483643
  59.       BorderStyle     =   1
  60.       Appearance      =   1
  61.       NumItems        =   3
  62.       BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  63.          Key             =   ""
  64.          Object.Tag             =   ""
  65.          Text            =   "Control"
  66.          Object.Width           =   4410
  67.       EndProperty
  68.       BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  69.          SubItemIndex    =   1
  70.          Key             =   ""
  71.          Object.Tag             =   ""
  72.          Text            =   "Caption"
  73.          Object.Width           =   3528
  74.       EndProperty
  75.       BeginProperty ColumnHeader(3) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  76.          SubItemIndex    =   2
  77.          Key             =   ""
  78.          Object.Tag             =   ""
  79.          Text            =   "Property  Value"
  80.          Object.Width           =   15875
  81.       EndProperty
  82.    End
  83.    Begin VB.CommandButton cmdClose 
  84.       Cancel          =   -1  'True
  85.       Caption         =   "Close"
  86.       Height          =   375
  87.       Left            =   6780
  88.       TabIndex        =   6
  89.       ToolTipText     =   "Hide the form"
  90.       Top             =   3900
  91.       Width           =   1215
  92.    End
  93.    Begin VB.Label Label2 
  94.       Caption         =   "&Property"
  95.       Height          =   255
  96.       Left            =   180
  97.       TabIndex        =   0
  98.       Top             =   120
  99.       Width           =   1155
  100.    End
  101.    Begin VB.Label Label1 
  102.       Caption         =   "&New Value="
  103.       Height          =   195
  104.       Left            =   120
  105.       TabIndex        =   5
  106.       Top             =   3600
  107.       Width           =   915
  108.    End
  109. End
  110. Attribute VB_Name = "frmAddIn"
  111. Attribute VB_GlobalNameSpace = False
  112. Attribute VB_Creatable = False
  113. Attribute VB_PredeclaredId = True
  114. Attribute VB_Exposed = False
  115. Option Explicit
  116.  
  117. Public VBInstance As VBIDE.VBE
  118. Public Connect As Connect
  119.  
  120. Private m_Component As VBComponent
  121.  
  122. Private Sub cmdClose_Click()
  123. 8 On Error GoTo ErrorHandler
  124.  
  125. 10     Connect.Hide
  126. 11     Exit Sub
  127.  
  128. 13 ErrorHandler:
  129. 14     MsgBox "frmAddIn.CancelButton_Click Line=" & Erl & vbCrLf & Err.Description
  130. End Sub
  131.  
  132. Public Function Create() As Boolean
  133. 18 On Error GoTo ErrorHandler
  134.  
  135. 20 Dim Ctrl As VBControl
  136.  
  137.  
  138.  
  139. 24 If VBInstance.SelectedVBComponent Is Nothing Then
  140. 25     Create = False
  141. 26     Exit Function
  142. 27 End If
  143.  
  144. 29 Set m_Component = VBInstance.SelectedVBComponent
  145.  
  146. 31 Select Case m_Component.Type
  147.         
  148. Case vbext_ct_PropPage, _
  149.     vbext_ct_UserControl, _
  150.     vbext_ct_VBForm, _
  151.     vbext_ct_VBMDIForm, _
  152.     vbext_ct_MSForm
  153. 38 Case Else
  154. 39     Exit Function
  155. 40 End Select
  156.  
  157. 42 Create = True
  158.  
  159. 44 Call LoadData
  160.  
  161. 46     Exit Function
  162.  
  163. 48 ErrorHandler:
  164. 49     MsgBox "frmAddIn.Create Line=" & Erl & vbCrLf & Err.Description
  165. End Function
  166.  
  167. Private Sub OKButton_Click()
  168. 53 On Error GoTo ErrorHandler
  169.  
  170. 55     MsgBox "AddIn operation on: " & VBInstance.FullName
  171. 56     Exit Sub
  172.  
  173. 58 ErrorHandler:
  174. 59     MsgBox "frmAddIn.OKButton_Click Line=" & Erl & vbCrLf & Err.Description
  175. End Sub
  176.  
  177. Public Sub AddControl(Ctrl As VBControl)
  178. 63 Dim LI As ListItem
  179. 64 Dim strValue As String
  180.  
  181. 66 On Error GoTo ErrorHandler
  182.         
  183. 68     strValue = Ctrl.Properties(txtProperty.Text)
  184.     
  185. 70     Set LI = lvwCtrls.ListItems.Add(Key:="K" & Ctrl.Properties!Name, Text:=Ctrl.Properties!Name)
  186. 71     On Error Resume Next
  187. 999    LI.SubItems(1) = Ctrl.Properties("Caption")
  188. 73     If Err <> 0 Then LI.SubItems(1) = Ctrl.Properties("LabelCaption")
  189. 74     LI.SubItems(2) = strValue
  190. 79 Exit Sub
  191.  
  192. 81 ErrorHandler:
  193. 82     Exit Sub
  194. End Sub
  195.  
  196. Private Sub cmdRefresh_Click()
  197.     Call LoadData
  198. End Sub
  199.  
  200. Private Sub lvwCtrls_ItemClick(ByVal Item As ComctlLib.ListItem)
  201. 88 On Error GoTo ErrorHandler
  202.  
  203. 90     txtValue.Text = Item.SubItems(2)
  204.  
  205. 92     Exit Sub
  206.  
  207. 94 ErrorHandler:
  208. 95     MsgBox "frmAddIn.lvwCtrls_ItemClick Line=" & Erl & vbCrLf & Err.Description
  209. End Sub
  210.  
  211.  
  212. Private Sub SaveValue()
  213. 107 On Error GoTo ErrorHandler
  214. 108     Dim Item As ListItem
  215.     
  216. 110     Set Item = lvwCtrls.SelectedItem
  217. 111     If Item Is Nothing Then Exit Sub
  218.  
  219. 113     Item.SubItems(2) = txtValue.Text
  220. 114     m_Component.Designer.VBControls(Item.Text).Properties(txtProperty.Text) = txtValue.Text
  221.     
  222. 116     Exit Sub
  223.  
  224. 118 ErrorHandler:
  225. 119     On Error Resume Next
  226.         Item.SubItems(2) = m_Component.Designer.VBControls(Item.Text).Properties(txtProperty.Text)
  227.         Exit Sub
  228. End Sub
  229.  
  230. Private Sub LoadData()
  231. 123 On Error GoTo ErrorHandler
  232. 124 Dim VBCtrl As VBControl
  233. 125 lvwCtrls.ListItems.Clear
  234. 126 txtValue.Text = ""
  235. 127 For Each VBCtrl In m_Component.Designer.VBControls
  236. 128     Call AddControl(VBCtrl)
  237. 129 Next VBCtrl
  238.     Exit Sub
  239.  
  240. 131 ErrorHandler:
  241. 132     MsgBox "frmAddIn.LoadData Line=" & Erl & vbCrLf & Err.Description
  242.  
  243. End Sub
  244.  
  245. Private Sub txtValue_Validate(Cancel As Boolean)
  246.     SaveValue
  247. End Sub
  248.