home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
- Begin VB.UserControl DictListView
- ClientHeight = 3375
- ClientLeft = 0
- ClientTop = 0
- ClientWidth = 4590
- ScaleHeight = 3375
- ScaleWidth = 4590
- Begin ComctlLib.ListView LV
- Height = 2415
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 2715
- _ExtentX = 4789
- _ExtentY = 4260
- View = 3
- LabelEdit = 1
- LabelWrap = -1 'True
- HideSelection = -1 'True
- _Version = 327682
- Icons = "ImageList1"
- SmallIcons = "ImageList1"
- ForeColor = -2147483640
- BackColor = -2147483643
- Appearance = 1
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 204
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- NumItems = 3
- BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
- Key = "Name"
- Object.Tag = ""
- Text = "Name"
- Object.Width = 2540
- EndProperty
- BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
- Key = "Type"
- Object.Tag = ""
- Text = "Type"
- Object.Width = 1270
- EndProperty
- BeginProperty ColumnHeader(3) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
- Key = "Value"
- Object.Tag = ""
- Text = "Value"
- Object.Width = 5080
- EndProperty
- End
- Begin ComctlLib.ImageList ImageList1
- Left = 3840
- Top = 2700
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 16777215
- _Version = 327682
- BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
- NumListImages = 2
- BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
- Picture = "DictListView.ctx":0000
- Key = ""
- EndProperty
- BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
- Picture = "DictListView.ctx":031A
- Key = ""
- EndProperty
- EndProperty
- End
- End
- Attribute VB_Name = "DictListView"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = False
- Option Explicit
-
- Dim mPath As String
-
- Public Event OpenItem(ByVal ItemName As String)
-
- Public Property Get Path() As String
- Path = mPath
- End Property
-
- Public Property Let Path(ByVal vNewValue As String)
-
- Dim i As TIDICTIONARYLib.Item, LI As ListItem
-
- mPath = vNewValue
- LV.ListItems.Clear
- If mPath = "@" Then
- Dict.GoPath mPath ' or Dict.GoRoot
- Else
- Dict.GoPath(mPath).Open
- LV.ListItems.Add , "..", "..", 2, 2
- End If
-
- On Error Resume Next
- For Each i In Dict
- If i.IsDictionary Then
- Set LI = LV.ListItems.Add(, i.Name, i.Name, 1, 1)
- Else
- Set LI = LV.ListItems.Add(, i.Name, i.Name)
- LI.SubItems(1) = TypeName(i.Value)
- LI.SubItems(2) = CStr(i.Value)
- If Err.Number Then LI.SubItems(3) = "(Error)"
- End If
- Set LI = Nothing
- Next
- End Property
-
- Private Sub LV_DblClick()
- If Not LV.SelectedItem Is Nothing Then
- If LV.SelectedItem.Icon Then RaiseEvent OpenItem(LV.SelectedItem.Key)
- End If
- End Sub
-
- Private Sub UserControl_Resize()
- On Error Resume Next
- LV.Move ScaleLeft, ScaleTop, ScaleWidth, ScaleHeight
- End Sub
-
- Private Function UniqueControlName()
- On Error Resume Next
- Dim N$
- N = Extender.Name
- N = N & Extender.Index
- UniqueControlName = N
- End Function
-
- ' state persisting methods
- Public Sub ReadState(St As Dictionary)
- On Error GoTo ExitSub
- St(UniqueControlName()).Open
- Dim CH As ColumnHeader
- For Each CH In LV.ColumnHeaders
- CH.Width = St(CH.Key).Value
- Next
- St.Close
- ExitSub:
- Err.Clear
- End Sub
-
- Public Sub WriteState(St As Dictionary)
- On Error GoTo ExitSub
- St.Add(UniqueControlName()).Open
- Dim CH As ColumnHeader
- For Each CH In LV.ColumnHeaders
- St.Add(CH.Key).Value = CH.Width
- Next
- St.Close
- ExitSub:
- Err.Clear
- End Sub
-
-