How to use a dictionary instead of a ListBox.RowTagAt?

Hi,
In the MBS example “/MacOSX/NWPathMonitor Test”, the data (dim value As Variant) is stored in a ListBox.RowTag. How to store the data in a dictionary, instead of the rowTag, to be independent of the hierarchical ListBox in the example?

UtilModule > AddFolder(extends list as listbox, name as string, RowTag as Variant) :

list.RowTag(list.LastIndex) = RowTag  //now DesktopListBox.RowTagAt()

ListBox.ExpandRow event :

Dim value As Variant = Me.RowTagAt(row)
AddValue value

Thanks

You have to cast the variant to a dictionary:

if UserData.Type <> Variant.TypeObject then Return
dim FontDictionary as Dictionary = Dictionary(UserData)

It wouldn’t be prudent to use a dictionary because dictionary keys are variants and a Listbox is a list. A property of the window that is an array of variants would be able to easily maintain the same structure as the Listbox.