Technical Support
🟢 Online now
Hello 👋

How can we help you today?
Contact on WhatsApp
B4X Store
jdashboardUI / Menús y navegación / JTreeList
Menús y navegación

JTreeList

Explorador de proyectos con nodos, imágenes, eventos, selección y menús contextuales

Buscar en toda jdashboardUI
Fuente
jdashboardUI.b4xlib · Solo API pública
Idioma de la tienda: es

JTreeList es un explorador jerárquico de B4J basado en CustomListView. Organiza carpetas, proyectos, módulos, formularios y archivos mediante nodos padre e hijo. Cada nodo tiene un texto visible y puede conservar un Tag para identificar rutas, registros o IDs internos. Permite expandir, contraer, seleccionar, cambiar títulos sin reconstruir el árbol y mostrar menús contextuales.

Crear el primer árbol

  1. En B4J activa jdashboardUI y agrega el CustomView JTreeList al Designer.
  2. Asigna el nombre ProjectTree y configura ancho, altura, sangría, colores, HeaderText y EmptyText.
  3. Después de cargar el layout crea los nodos. Guarda los objetos retornados para modificarlos después.
  4. Implementa ProjectTree_ItemClick(Item As Object) y, cuando necesites acciones contextuales, ProjectTree_ItemRightClick(Item As Object, EventData As MouseEvent).
Dim raiz As Object = ProjectTree.AddRootItem("Proyecto", Chr(0xF07B), _
    xui.CreateFontAwesome(16), 0xFFE4AB39, "proyecto")
Dim modulos As Object = ProjectTree.AddChildItem(raiz, "Módulos", Chr(0xF07B), _
    xui.CreateFontAwesome(16), 0xFFE4AB39, "modulos")
Dim principal As Object = ProjectTree.AddChildItem(modulos, "Main.bas", Chr(0xF15C), _
    xui.CreateFontAwesome(16), 0xFF4891CD, "Main.bas")

ProjectTree.ToggleItem(raiz)
ProjectTree.ToggleItem(modulos)

Private Sub ProjectTree_ItemClick(Item As Object)
    Log("Seleccionado: " & ProjectTree.GetItemTag(Item))
End Sub

Los nodos con hijos alternan su expansión al pulsarlos. Los nodos hoja disparan el clic de selección. Usa SetNodeText(principal, "MainNuevo.bas") para cambiar el nombre conservando la identidad. SetNodeTexts(Updates As Map) permite actualizar varios títulos. Con SelectItemByTag puedes localizar un elemento por su dato interno.

Iconos y menús

  • AddRootItem y AddChildItem: iconos de fuente.
  • AddRootItemImageFile y AddChildItemImageFile: imágenes de archivos.
  • AddRootItemImage y AddChildItemImage: imágenes B4XBitmap.
  • SetContextMenu: integración con un menú jFloatingMenu.
  • ApplyThemeColors, SetItemBackgroundColor y SetItemTextColor: integración visual con el tema de la aplicación.

Casos de uso

Un explorador de proyectos puede abrir el módulo seleccionado en MonacoEditorView; un organizador documental puede usar rutas como Tag; un inspector de datos puede mostrar bases, tablas y columnas. En esta versión JTreeList no tiene AddToParent público; utiliza el Designer como forma normal de creación.

La referencia siguiente documenta los 27 métodos públicos, eventos, parámetros, resultados, propiedades del Designer y ejemplos avanzados, con las firmas originales B4J sin traducciones que alteren el código.

Referencia técnica completa, firmas de API y casos avanzados

Library: jdashboardUI · Platform: B4J / JavaFX · Verified against: jdashboardUI(20261108-154221).b4xlib (8 November 2026). New documentation page: JTreeList was not listed as a standalone module on the inspected official index.

JTreeList is a hierarchical list for representing project trees, folders, document categories and expandable navigation. Unlike a regular CustomListView, each entry knows its parent and children. You can expand and collapse nodes, attach user-defined Tag values, select nodes, change their labels without rebuilding the whole tree, apply themes, and attach a context menu. It is implemented using CustomListView, not JavaFX's native TreeView.

1. Common use cases

  • Project explorer: Project → Resources / Forms / VBA → Module1.bas, Form1, Ribbon.xml.
  • Document organizer: Client → Year → Folder → Document, using the file's path as the node Tag.
  • Application navigation: Module group → feature. When a leaf is clicked, open a specific view in another panel.
  • Data inspector: Database → Tables → Columns; use SetNodeTexts to refresh renamed records efficiently.
  • Designer outline: Form → Container → Buttons, labels and other controls. Store stable internal IDs in Tag rather than relying on translated text.

Do not confuse Text and Tag: text is a visible caption that may change or be localized; Tag is arbitrary application data, such as a file path, record ID, or object reference. AddRootItem... and AddChildItem... return node object references. Save those references if you plan to change, remove or select those nodes later.

2. Set up JTreeList in B4J Designer

  1. Select jdashboardUI in the B4J Libraries Manager.
  2. Add a JTreeList CustomView to a B4J layout and give it an event name, for example ProjectTree.
  3. Give it enough width for indented labels. Save and load the layout before you populate nodes.
  4. Optionally configure BasePadding, IndentSize, HeaderText, HeaderColor, EmptyText and default colors in the Designer.
  5. Implement ProjectTree_ItemClick(Item As Object) for leaf nodes and ProjectTree_ItemRightClick(Item As Object, EventData As MouseEvent) for right-click actions.

Important: this build exposes Initialize and DesignerCreateView but no public AddToParent method for JTreeList. The supported, straightforward initialization is through a Designer CustomView. Avoid calling DesignerCreateView manually in ordinary consumer code unless you have a specific advanced reason and provide all required properties.

3. Build your first project tree

The following example assumes the Designer CustomView is named ProjectTree and the code runs after MainForm.RootPane.LoadLayout("Main").

Sub Process_Globals
    Private fx As JFX
    Private xui As XUI
    Private ProjectTree As JTreeList
    Private RootProject As Object
    Private RootModules As Object
    Private NodeMain As Object
    Private NodeUtils As Object
End Sub

Private Sub BuildProjectTree
    ProjectTree.SetHeader("Project Explorer", 0xFF273B63)
    ProjectTree.SetEmptyText("There are no project files")

    RootProject = ProjectTree.AddRootItem("Demo Project", Chr(0xF07B), _
        xui.CreateFontAwesome(16), 0xFFE4AB39, "project")

    RootModules = ProjectTree.AddChildItem(RootProject, "Modules", Chr(0xF07B), _
        xui.CreateFontAwesome(16), 0xFFE4AB39, "modules")

    NodeMain = ProjectTree.AddChildItem(RootModules, "Main.bas", Chr(0xF15C), _
        xui.CreateFontAwesome(16), 0xFF4891CD, "Main.bas")

    NodeUtils = ProjectTree.AddChildItem(RootModules, "Utils.bas", Chr(0xF15C), _
        xui.CreateFontAwesome(16), 0xFF4891CD, "Utils.bas")

    ProjectTree.ToggleItem(RootProject)
    ProjectTree.ToggleItem(RootModules)
End Sub

Private Sub ProjectTree_ItemClick(Item As Object)
    Dim id As Object = ProjectTree.GetItemTag(Item)
    Log("Leaf selected: " & id)
End Sub

What happens: clicking a parent that has children expands or contracts it; clicking a leaf selects it and raises ItemClick. The source deliberately treats parent clicks as expansion commands rather than firing the leaf-selection callback. The Tag is useful for opening the correct module without comparing localized visible labels.

4. Choose between font icons, file images and B4XBitmap

4.1. Font icons

AddRootItem and AddChildItem accept an icon character, an B4XFont, color and Tag. A color of 0 means use the configured default/icon inheritance; this is different from requesting a transparent color. Ensure the glyph matches the chosen font.

4.2. Images loaded from files

Dim imagesRoot As Object = ProjectTree.AddRootItemImageFile("Images", _
    File.DirAssets, "folder.png", "imagesRoot")
Dim pngNode As Object = ProjectTree.AddChildItemImageFile(imagesRoot, "logo.png", _
    File.DirAssets, "image.png", "logoFile")
ProjectTree.ToggleItem(imagesRoot)

Use these methods when you have packaged PNG/JPG assets or local application files. File existence matters; put bundled resources in the B4J Files tab and use File.DirAssets.

4.3. Images already held in memory

Dim bmp As B4XBitmap = xui.LoadBitmap(File.DirAssets, "folder.png")
Dim rootImg As Object = ProjectTree.AddRootItemImage("Media", bmp, "media")
ProjectTree.AddChildItemImage(rootImg, "Picture A", bmp, "pictureA")

Use B4XBitmap when the bitmap was already created, downloaded or transformed by another component. Avoid loading the same large image repeatedly for hundreds of nodes when you could reuse a bitmap.

5. Stable node references and Tags

Dim node As Object = ProjectTree.AddRootItem("Report A", "", Null, 0, "report:100")
Dim tagValue As Object = ProjectTree.GetItemTag(node)
Log(tagValue)

If ProjectTree.SelectItemByTag("report:100") Then
    Log("Found and selected report")
End If

SelectItemByTag(Tag) searches stored node tags, expands all ancestors of the matching node and selects it. It returns True if a match is found. Choose unique Tags if you need deterministic selection; if different nodes share a tag, the first match found by the map traversal wins. Do not assume a translated caption is a unique identifier.

SelectItem(Node) selects by object reference, and GetSelectedItem returns the current reference. The implementation of SelectItem simply changes the selected node and refreshes the tree; it does not automatically expand all ancestors. Prefer SelectItemByTag when the target may be hidden under collapsed parents.

6. Rename one node without rebuilding the tree

Dim ok As Boolean = ProjectTree.SetNodeText(NodeMain, "Main (updated).bas")
If ok = False Then Log("The node is not currently part of the tree")

SetNodeText returns False if the passed node is not actually part of the current tree. When valid, the node's model text is updated and the existing visible label is updated in place, including its row height if the new caption takes more lines. This avoids unnecessary collapsing, rebuilding or regenerating event references. A hidden descendant retains its updated text in the model and displays it when a parent is expanded. Text changes do not raise ItemClick or ItemRightClick.

Call node-edit methods on the JavaFX application thread; the source explicitly documents this restriction for SetNodeText.

7. Rename many nodes efficiently

Dim updates As Map
updates.Initialize
updates.Put(NodeMain, "MainModule.bas")
updates.Put(NodeUtils, "UtilityFunctions.bas")
Dim missing As List = ProjectTree.SetNodeTexts(updates)
If missing.Size > 0 Then
    Log("One or more node references were not in this tree: " & missing.Size)
End If

The keys in the Map must be the node objects returned by AddRootItem/AddChildItem, not text strings or Tags. Values are replacement strings. Unchanged text is accepted as a successful update. The result is a List of keys that were not found. Each changed visible label is updated without a full tree rebuild; nodes hidden under collapsed parents get the new text in the data model and render it later.

This method is especially useful when synchronizing a project explorer after renaming multiple modules, translating captions or refreshing database item descriptions.

8. Expand, collapse, remove and clear

ProjectTree.ToggleItem(RootModules)  ' Toggle expanded/collapsed.
ProjectTree.RemoveItem(NodeUtils)    ' Delete this node from its parent.
ProjectTree.Clear                    ' Remove the whole tree.

ToggleItem flips the Expanded field even when the node has no children (a leaf has nothing visible to expand). RemoveItem deletes the node from the hierarchy and refreshes the view. Clear removes all root items and the node lookup map. Keep your application-owned references synchronized; a reference held after removal should no longer be treated as an active node. The source checks real parent-child links when deciding whether a reference is still part of the tree for SetNodeText.

9. Apply a theme and style individual nodes

ProjectTree.ApplyThemeColors(0xFFECEFF4, 0xFF17212E, _
    0xFF31527A, 0xFF263B55, 0xFF273B63)
ProjectTree.SetTextFont(xui.CreateDefaultFont(13))
ProjectTree.SetItemTextColor(NodeMain, 0xFF7FB5FF)
ProjectTree.SetItemBackgroundColor(NodeMain, 0xFF1B344C)
ProjectTree.SetHeader("Project Explorer", 0) ' 0 keeps the current header color.

ApplyThemeColors also updates existing stored nodes; it does not only change future default colors. SetItemTextColor/SetItemBackgroundColor are appropriate when one node needs special emphasis (for example, a file with an error), but after applying a whole-tree theme you may need to reapply special per-node colors.

10. Context menu and right-click

SetContextMenu(Menu As jFloatingMenu) assigns a library jFloatingMenu object. First initialize and populate the floating menu, then assign it:

' Additional fields in your module:
Private TreeContext As jFloatingMenu
Private RightClickedNode As Object

Private Sub BuildContextMenu
    TreeContext.Initialize(Me, ProjectTree.GetBase, 0, 0, 220dip, 130dip)
    TreeContext.AddMenuItem("OpenNode", Chr(0xF07C), xui.CreateFontAwesome(16), _
        0xFF2D80D3, "Open", 0xFFEEEEEE, "Open selected document")
    TreeContext.AddMenuItem("DeleteNode", Chr(0xF1F8), xui.CreateFontAwesome(16), _
        0xFFCB4B5A, "Remove", 0xFFEEEEEE, "Remove selected node")
    ProjectTree.SetContextMenu(TreeContext)
End Sub

Private Sub ProjectTree_ItemRightClick(Item As Object, EventData As MouseEvent)
    RightClickedNode = Item
    Log("Right-clicked: " & ProjectTree.GetItemTag(Item))
End Sub

Private Sub OpenNode_OptionMenuClicked
    If RightClickedNode = Null Then Return
    Log("Open: " & ProjectTree.GetItemTag(RightClickedNode))
End Sub

Private Sub DeleteNode_OptionMenuClicked
    If RightClickedNode = Null Then Return
    ProjectTree.RemoveItem(RightClickedNode)
    RightClickedNode = Null
End Sub

Run BuildContextMenu after the Designer layout has loaded, and keep TreeContext and RightClickedNode as module-level fields. jFloatingMenu uses the callback convention <ItemEventName>_OptionMenuClicked for normal items (rather than the JMenuBar convention <EventName>_Click). The tree callback receives the node reference and a JavaFX MouseEvent; retain that reference so the menu action knows the target. A right-click does not invoke the normal leaf ItemClick callback—those are separate events.

11. Header, empty state, resizing and underlying list

ProjectTree.SetHeader("Resources", 0xFF273B63)
ProjectTree.SetEmptyText("No resources yet")
Dim base As B4XView = ProjectTree.GetBase
Dim innerList As CustomListView = ProjectTree.GetCustomListView

The header remains visible even when no items exist. GetBase gives access to the containing B4X view, useful for positioning the CustomView within a layout. GetCustomListView exposes the internal list for advanced integration, but modifying its rows directly can conflict with the tree's own parent/child model. Prefer the official tree API for adding/removing/changing nodes. Base_Resize(Width,Height) is public and the component uses it to resize its header and list; in Designer projects normal layout resizing is the usual mechanism.

12. Troubleshooting and behavioral details

Symptom Explanation Action
Clicking a folder does not fire ItemClick Folder clicks are handled as expand/collapse Use a leaf to trigger ItemClick, or use your own UI command to handle folders.
A renamed node seems unchanged It is currently hidden under a collapsed parent Expand its ancestors; model text was updated.
SetNodeText returns False Node is not in the active tree (or ancestor was removed) Retain fresh node references and check the tree lifecycle.
SetNodeTexts reports missing nodes Map keys are Tags or stale references rather than real node objects Use the Object return values from Add* methods.
A bitmap is absent Image not loaded or invalid directory Check File.DirAssets/File.DirApp path and file.
Many labels wrap unexpectedly Too much indentation for the view width Increase width or decrease IndentSize.
SelectItem selects a hidden child Its parents remain collapsed Use SelectItemByTag to expand ancestors automatically.
Theme overwrites highlighted node Theme applies to existing nodes Apply per-node highlight after the global theme.
Cannot create JTreeList with AddToParent No such public method is present Use a Designer CustomView.

13. Public API — exhaustive signatures and descriptions

The appendix includes every Public Sub in JTreeList.bas from the provided library version. Node parameters that are typed Object represent actual node references; do not replace them with the visible caption unless the method explicitly says it accepts a String tag. Tag values themselves are application-defined objects.


Complete source-verified reference: JTreeList

Declared events

  • ItemClick (Item As Object)

  • ItemRightClick (Item As Object, EventData As MouseEvent)

These are events explicitly declared with #Event in this class. Public bridge functions without a corresponding #Event are not automatically consumer callbacks.

Designer properties and defaults

Property key Field type Default / options Meaning

| BasePadding | Int | 12 | Visual Designer configuration; the corresponding runtime property, if available, appears in the method reference. |

| IndentSize | Int | 20 | Visual Designer configuration; the corresponding runtime property, if available, appears in the method reference. |

| IconVerticalOffset | Int | 0 | Visual Designer configuration; the corresponding runtime property, if available, appears in the method reference. |

| DefaultIconColor | Color | 0xFF333333 | Visual Designer configuration; the corresponding runtime property, if available, appears in the method reference. |

| DefaultTextColor | Color | 0xFF000000 | Visual Designer configuration; the corresponding runtime property, if available, appears in the method reference. |

| DefaultBackgroundColor | Color | 0x00FFFFFF | Visual Designer configuration; the corresponding runtime property, if available, appears in the method reference. |

| SelectedColor | Color | 0xFFE3F2FD | Visual Designer configuration; the corresponding runtime property, if available, appears in the method reference. |

| HoverColor | Color | 0xFFF5F5F5 | Visual Designer configuration; the corresponding runtime property, if available, appears in the method reference. |

| HeaderText | String | Archivos | Visual Designer configuration; the corresponding runtime property, if available, appears in the method reference. |

| HeaderColor | Color | 0xFF273B63 | Visual Designer configuration; the corresponding runtime property, if available, appears in the method reference. |

| EmptyText | String | Sin elementos para mostrar | Visual Designer configuration; the corresponding runtime property, if available, appears in the method reference. |

These keys configure a Designer CustomView. They are not automatically callable setters; check the public method list before writing Component.Property = value.

All JTreeList Public Sub declarations (27)

JTreeList.Initialize

Public Sub Initialize (Callback As Object, EventName As String)

Initializes callback identifiers and the root, item and visible-row lookup structures.

Parameters:

  • Callback (Object): B4J object that receives the component events (normally Me).
  • EventName (String): Unique, stable identifier used for command callbacks and later lookups.

Returns: no return value (Sub).

Lifecycle: normally called by framework initialization or by the code-created pattern; do not call the Designer lifecycle method again after LoadLayout.

JTreeList.DesignerCreateView

Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)

Creates the header and underlying CustomListView after a Designer layout loads.

Parameters:

  • Base (Object): The view supplied by the B4J Designer.
  • Lbl (Label): The Designer label carrying font and text settings.
  • Props (Map): A Map of properties provided by the Designer.

Returns: no return value (Sub).

Lifecycle: normally called by framework initialization or by the code-created pattern; do not call the Designer lifecycle method again after LoadLayout.

JTreeList.Base_Resize

Public Sub Base_Resize (Width As Double, Height As Double)

Adjusts header and list bounds when the container changes size.

Parameters:

  • Width (Double): Width expressed in device-independent pixels (dip).
  • Height (Double): Height expressed in device-independent pixels (dip).

Returns: no return value (Sub).

JTreeList.AddRootItem

Public Sub AddRootItem(Text As String, Icon As String, IconFont As B4XFont, IconColor As Int, Tag As Object) As Object

Adds a root node with a font glyph; returns the node object used by subsequent API calls.

Parameters:

  • Text (String): Text to display, search or insert, depending on the method.
  • Icon (String): Font-glyph character used in a button or node.
  • IconFont (B4XFont): B4XFont/Font containing the chosen glyph.
  • IconColor (Int): Color assigned to the glyph (usually ARGB).
  • Tag (Object): Application-defined data to associate with the node, such as a stable path or ID.

Returns: Object. A newly created or resolved node/view object.

JTreeList.AddChildItem

Public Sub AddChildItem(ParentItem As Object, Text As String, Icon As String, IconFont As B4XFont, IconColor As Int, Tag As Object) As Object

Adds a child below an existing node reference using a font glyph; returns a node object.

Parameters:

  • ParentItem (Object): Node reference returned by an earlier AddRootItem/AddChildItem call.
  • Text (String): Text to display, search or insert, depending on the method.
  • Icon (String): Font-glyph character used in a button or node.
  • IconFont (B4XFont): B4XFont/Font containing the chosen glyph.
  • IconColor (Int): Color assigned to the glyph (usually ARGB).
  • Tag (Object): Application-defined data to associate with the node, such as a stable path or ID.

Returns: Object. A newly created or resolved node/view object.

JTreeList.AddRootItemImageFile

Public Sub AddRootItemImageFile(Text As String, ImageDir As String, ImageFileName As String, Tag As Object) As Object

Adds an image-file-backed root node and returns its node reference.

Parameters:

  • Text (String): Text to display, search or insert, depending on the method.
  • ImageDir (String): Directory containing the image asset.
  • ImageFileName (String): Name of image file stored in ImageDir.
  • Tag (Object): Application-defined data to associate with the node, such as a stable path or ID.

Returns: Object. A newly created or resolved node/view object.

JTreeList.AddChildItemImageFile

Public Sub AddChildItemImageFile(ParentItem As Object, Text As String, ImageDir As String, ImageFileName As String, Tag As Object) As Object

Adds an image-file-backed child below an existing parent and returns its reference.

Parameters:

  • ParentItem (Object): Node reference returned by an earlier AddRootItem/AddChildItem call.
  • Text (String): Text to display, search or insert, depending on the method.
  • ImageDir (String): Directory containing the image asset.
  • ImageFileName (String): Name of image file stored in ImageDir.
  • Tag (Object): Application-defined data to associate with the node, such as a stable path or ID.

Returns: Object. A newly created or resolved node/view object.

JTreeList.AddRootItemImage

Public Sub AddRootItemImage(Text As String, Image As B4XBitmap, Tag As Object) As Object

Adds a root node with an already available B4XBitmap.

Parameters:

  • Text (String): Text to display, search or insert, depending on the method.
  • Image (B4XBitmap): The B4XBitmap used as the icon.
  • Tag (Object): Application-defined data to associate with the node, such as a stable path or ID.

Returns: Object. A newly created or resolved node/view object.

JTreeList.AddChildItemImage

Public Sub AddChildItemImage(ParentItem As Object, Text As String, Image As B4XBitmap, Tag As Object) As Object

Adds a child node with an existing B4XBitmap.

Parameters:

  • ParentItem (Object): Node reference returned by an earlier AddRootItem/AddChildItem call.
  • Text (String): Text to display, search or insert, depending on the method.
  • Image (B4XBitmap): The B4XBitmap used as the icon.
  • Tag (Object): Application-defined data to associate with the node, such as a stable path or ID.

Returns: Object. A newly created or resolved node/view object.

JTreeList.RemoveItem

Public Sub RemoveItem(Item As Object)

Removes a node from its parent or root list, then refreshes the tree.

Parameters:

  • Item (Object): Existing node reference or menu item, according to the method.

Returns: no return value (Sub).

JTreeList.ToggleItem

Public Sub ToggleItem(Item As Object)

Flips a node’s Expanded flag and refreshes the tree.

Parameters:

  • Item (Object): Existing node reference or menu item, according to the method.

Returns: no return value (Sub).

JTreeList.SelectItem

Public Sub SelectItem(Item As Object)

Selects a node by object reference; does not automatically expand collapsed parents.

Parameters:

  • Item (Object): Existing node reference or menu item, according to the method.

Returns: no return value (Sub).

JTreeList.GetSelectedItem

Public Sub GetSelectedItem As Object

Returns the currently selected node reference (or Null if none).

Returns: Object. A newly created or resolved node/view object.

JTreeList.SetContextMenu

Public Sub SetContextMenu(Menu As jFloatingMenu)

Assigns an initialized jFloatingMenu to be displayed on tree right-clicks.

Parameters:

  • Menu (jFloatingMenu): Initialized jFloatingMenu for the tree context menu.

Returns: no return value (Sub).

JTreeList.SetNodeText

Public Sub SetNodeText(Node As Object, NewText As String) As Boolean

Renames one active node; updates its existing visible row in place, and returns False for a stale/missing node.

Parameters:

  • Node (Object): Node object returned from a JTreeList Add* method.
  • NewText (String): Replacement node caption.

Returns: Boolean. Success/failure status.

JTreeList.SetNodeTexts

Public Sub SetNodeTexts(Updates As Map) As List

Renames multiple nodes from a Map keyed by node references; returns a List of missing references.

Parameters:

  • Updates (Map): Map: node reference → new display-text string.

Returns: List. The returned value; check readiness and validity as explained in the tutorial.

JTreeList.SetTextFont

Public Sub SetTextFont(Font As B4XFont)

Changes the font used to display node labels.

Parameters:

  • Font (B4XFont): B4XFont to use in labels or menus.

Returns: no return value (Sub).

JTreeList.SetItemBackgroundColor

Public Sub SetItemBackgroundColor(Item As Object, Color As Int)

Changes one node’s background color.

Parameters:

  • Item (Object): Existing node reference or menu item, according to the method.
  • Color (Int): ARGB color; some methods use zero as a special “keep/inherit” value.

Returns: no return value (Sub).

JTreeList.SetItemTextColor

Public Sub SetItemTextColor(Item As Object, Color As Int)

Changes one node’s label color.

Parameters:

  • Item (Object): Existing node reference or menu item, according to the method.
  • Color (Int): ARGB color; some methods use zero as a special “keep/inherit” value.

Returns: no return value (Sub).

JTreeList.GetBase

Public Sub GetBase As B4XView

Returns the tree’s containing B4XView.

Returns: B4XView. The returned value; check readiness and validity as explained in the tutorial.

JTreeList.GetCustomListView

Public Sub GetCustomListView As CustomListView

Exposes the underlying CustomListView for advanced integration; do not mutate its rows behind the tree model.

Returns: CustomListView. The returned value; check readiness and validity as explained in the tutorial.

JTreeList.Clear

Public Sub Clear

Removes all root nodes and node lookup entries and refreshes the list.

Returns: no return value (Sub).

JTreeList.GetItemTag

Public Sub GetItemTag(Item As Object) As Object

Returns the application-supplied Tag value of a node.

Parameters:

  • Item (Object): Existing node reference or menu item, according to the method.

Returns: Object. A newly created or resolved node/view object.

JTreeList.SetHeader

Public Sub SetHeader(Text As String, Color As Int)

Changes the panel header text; a zero color argument preserves its existing color.

Parameters:

  • Text (String): Text to display, search or insert, depending on the method.
  • Color (Int): ARGB color; some methods use zero as a special “keep/inherit” value.

Returns: no return value (Sub).

JTreeList.ApplyThemeColors

Public Sub ApplyThemeColors(TextColor As Int, BackgroundColor As Int, SelectedColor As Int, HoverColor As Int, HeaderColor As Int)

Applies a new palette to the tree and all existing nodes, refreshing the view.

Parameters:

  • TextColor (Int): ARGB label color.
  • BackgroundColor (Int): ARGB background color.
  • SelectedColor (Int): ARGB selection color.
  • HoverColor (Int): ARGB hover color.
  • HeaderColor (Int): ARGB header color.

Returns: no return value (Sub).

JTreeList.SetEmptyText

Public Sub SetEmptyText(Text As String)

Sets the message shown when no node is available.

Parameters:

  • Text (String): Text to display, search or insert, depending on the method.

Returns: no return value (Sub).

JTreeList.SelectItemByTag

Public Sub SelectItemByTag(Tag As Object) As Boolean

Finds a node with a matching Tag, expands its ancestors, selects it and returns True; returns False if not found.

Parameters:

  • Tag (Object): Application-defined data to associate with the node, such as a stable path or ID.

Returns: Boolean. Success/failure status.