DesktopTreeViewLibrary provides a pixel-scrolling TreeView for Xojo Desktop. It consists of:
- DesktopTreeViewCntrl (ContainerControl): owns scrollbar and layout
- XojoTreeView (Canvas-based control): owns rendering, hit-testing, row rebuilding, and scroll physics
This file documents the current cleaned API only.
Bind the tree view to its data and host. This is a one-time operation.
Call after mutating the bound tree structure to rebuild rows and refresh display.
Set vertical scroll position in pixels. Value is clamped internally.
Returns the maximum legal scroll position in pixels for the current content.
Emitted when the tree scroll position changes (mouse wheel, drag, expand/collapse).
- payload: current scroll position in pixels (string form)
The host is expected to:
- update scrollbar MaximumValue using MaxScrollY
- clamp scrollbar Value
- guard against feedback loops
- Fire(...) is Protected
- prevents external event spoofing
- allows subclasses to emit legitimate notifications
All rendering, layout, and rebuild helpers are Private.
- Pixel-based scrolling
- Scrollbar.Value == mScrollY
- Scrollbar.MaximumValue == MaxScrollY
- Scrollbar.PageStep == viewport height
When a disclosure triangle is clicked:
- Toggle _Expanded
- Rebuild visible rows immediately
- Clamp scroll
- Refresh view
- Emit ScrollChanged
This guarantees scrollbar and mouse wheel never desync.
Reserved keys:
- _Key : String (unique id)
- _Value : display value
- _Expanded : Boolean
- _Children : Dictionary (child nodes)
Additional domain-specific keys are allowed.
Bind once: XTree.BeginUse(rootDict, levelSpec, Self)
After tree mutation: XTree.Update
API frozen for v1.0.