I have an hierarchical listbox that gets populated using a hierarchical, in memory, datastructure (a.k.a treenode)
when I expand a row, each parent-treenode (attached to the rowtag) show its childnodes.
On my Mac this is blazing fast but on a Windows PC the same listbox needs multiple seconds for even a few childrows to show.
A few dozen rows can take a whole minute before they appear.
if (row >= 0) and (row < sender.ListCount) then
if sender.RowIsFolder(row) then
dim expandedNode as JVtreeNode = sender.RowTag(row)
For each childNode as JVtreeNode in expandedNode.children
displayNode(childNode)
next
// Remember this row as being expanded
dim pathString as String = pathForRow(row)
dim index as Integer = expandedNodes.IndexOf(pathString)
if index < 0 then
expandedNodes.append(pathString)
end if
end if
end if[/code]
then in displayNode(node as JVTreeNode)
[code]if node <> nil then
dim numberOfFields as Integer
if node.representedObject isa Dictionary then
dim representedObject as Dictionary = node.representedObject
numberOfFields = representedObject.keys.ubound+1
elseif node.representedObject isa DatabaseRecord then
dim representedObject as DatabaseRecord = node.representedObject
numberOfFields = representedObject.FieldCount
end if
// Adjust the number of columns if needed
treeView.ColumnCount = Max(treeView.ColumnCount, numberOfFields)
// Proces the record
dim itsAnExpandableNode as Boolean =(treeView.treeViewDataSource.isItemExpandable(node))
if itsAnExpandableNode then // Add an empty Folder or an empty row
treeView.AddFolder("")
else
treeView.AddRow()
end if
dim newRowNumber as Integer = treeView.LastIndex
treeview.RowTag(newRowNumber) = node
// Proces the individual fields
for fieldNumber as Integer = 0 to numberOfFields-1
dim fieldName as Variant
dim fieldValue as Variant
if node.representedObject isa Dictionary then
dim representedObject as Dictionary = node.representedObject
fieldName = representedObject.key(fieldNumber)
fieldValue = representedObject.value(fieldName)
elseif node.representedObject isa DatabaseRecord then
dim representedObject as DatabaseRecord = node.representedObject
fieldName = representedObject.FieldName(fieldNumber)
fieldValue = representedObject.Column(fieldName.StringValue)
end if
// Prepare the field in the backend
dim tagValue as Pair = fieldName: fieldValue
treeView.celltag(newRowNumber, fieldNumber) = tagValue
// Make the cell redraw itself
treeView.InvalidateCell(newRowNumber, fieldNumber)
next
end if
so it looks like you are NOT having an issue with an Xojo Listbox… but rather some 3rd party treeview control.(JVTree?)… in which case it might be best to contact the author for support
[quote=384300:@Jan Verrept]JVTree is just a my own subclass of listbox that has the hierarchical-property set to True.
Nothing special about it.[/quote]
ok… well can’t help… good luck
I’ve subclassed the listbox control and build my own with data initially stored into memory and show only what you need plus a little bit more on top and bottom to have smooth scrolling. And this works up to 200 k rows , even on Windows but with 2017R3. With the speed of 2018R1 on Windows you can’t make anything behave satisfactory at all.