B4A Library [B4X] [XUI] SD_TreeList

Download a Library from Here

SD_TreeList

Author:
Star-Dust
Version: 0.19
  • B4XTree
    • Events:
      • Click (IDLeaf As String, LeafName As String)
      • ClickBranch (ID As String, Expanded As Boolean)
      • LongRightClick (IDLeaf As String, LeafName As String)
    • Fields:
      • BadgeBackgroundColor As Int
      • BadgeDept As Int
      • BadgeTextColor As Int
      • BadgeTextSize As Int
    • Functions:
      • Add (Name As String, IDBranch As String, FontAwesoneSymbol As String, Color As Int, ListLeaf As String()) As String
        Add Branch with Symbol(FontAwesone) and Leaf (list)
      • Add2 (Name As String, IDBranch As String, Symbol As String, FontSymbol As B4XFont, Color As Int, ListLeaf As String()) As String
        Add Branch with Symbol(FontAwesone) and Leaf (list)
      • AddBranch (Name As String, IDBranch As String, IDParent As String, FontAwesoneSymbol As String, Color As Int) As String
        Add Branch
      • AddBranch2 (Name As String, IDBranch As String, IDParent As String, Symbol As String, FontSymbol As B4XFont, Color As Int) As String
        Add Branch with Symbol
      • AddBranchDoubleSymbol (Name As String, IDBranch As String, IDParent As String, OpenSymbol As String, CloseSymbol As String, FontSymbol As B4XFont, Color As Int) As String
        Add Branch with double symbol
      • AddDoubleSymbol (Name As String, IDBranch As String, OpenSymbol As String, CloseSymbol As String, FontSymbol As B4XFont, Color As Int, ListLeaf As String()) As String
        Add Branch with double Symbol and Leaf (list)
      • AddLeaf (Name As String, Info As String, IDBLeaf As String, IDParent As String) As String
        Add Leaf to branch
      • AddLeafOnTop (Name As String, Info As String, IDLeaf As String, IDBranch As String) As String
        Add Leaf on top to Branch
      • Class_Globals As String
      • Clear As String
      • CollapsesAllBranch As String
      • CollapsesBranch (IDBranch As String) As String
      • CollapsesBranchAndSOn (IDBranch As String) As String
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • ExpandAllBranch As String
      • ExpandBranch (IDBranch As String) As String
      • ExpandBranchAndSon (IDBranch As String) As String
      • GetBranchName (IDBranch As String) As String
      • GetBranchOfLeaf (IDLeaf As String) As String
      • GetLeafInfo (IDLeaf As String) As String
      • GetLeafName (IDLeaf As String) As String
      • Initialize (Callback As Object, EventName As String) As String
      • Invalidate
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • ListOfIDBraches (IDBranche As String) As List
        Returns a list of strings
        This list contains the IDs of the sub-branches attached To a branch
      • ListOfIDLeafs (IDBranche As String) As List
        Returns a list of strings
        This list contains the IDs of the leaves attached To a branch
      • MoveLeaf (IDLeaf As String, NewIDBranch As String) As String
      • RemoveBranch (IDBranch As String) As String
      • RemoveLeaf (IDLeaf As String) As String
      • SetBranch (IDBranch As String, NewName As String) As String
      • SetLayout (Left As Int, Top As Int, Widh As Int, Height As Int) As String
      • SetLeaf (IDLeaf As String, NewName As String, NewInfo As String) As String
      • SetLeafBadge (IDLeaf As String, BadgeActive As Boolean, BadgeText As String) As String
      • Sort (Ascending As Boolean) As String
      • TreeToJson As String
    • Properties:
      • Base As B4XView [read only]
      • BranchTextColor As Int
      • Height As Int
      • ItemHeight As Int
        Min = 40dip, Max= 100dip
      • LeafTextColor As Int
      • Left As Int
      • OnlyCornerColor As Boolean
      • OpenOnlyOneBranch As Boolean
      • TextSize As Int
      • TimeAnimation As Int
      • Top As Int
      • Width As Int


Preview.gif


Badge on leaf
1614958994789.png
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Update 0.05
  • The methods for inserting the leaves have changed. Now the leaves require an ID and the raised event returns the ID
  • It is possible to move the leaves in another branch
  • It is possible to update the name and leaf info
  • Add Left,Top,Width,Height parameter
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Can you add some function to modify text of Leafs or Branchs.
For example:
BXTree1.Branch(Index).text="some text"
BXTree1.Branch(Index).Enabled=True/False
BXTree1.Branch(Index).Visible=True/False
BXTree1.Branch(Index).Leaf(index).Text="SOME Text"
BXTree1.Branch(Index).Leaf(index).Enabled=True/false
BXTree1.Branch(Index).Leaf(index).Visible=True/false

also
add read function as
BxTree1.Branch.Count
BxTree1.Branch(Index).Leaf.Count
BxTree1.branch(index).Parent
if Parent=root then Parent= -1
Dear @Alex_Puz,
This is a free library, which meets my development needs and I'm sharing it.
I do not guarantee assistance, updates and add methods on request. Although sometimes I could accept some requests.
 

Alex_Puz

Member
Licensed User
Longtime User
Dear @Alex_Puz,
This is a free library, which meets my development needs and I'm sharing it.
I do not guarantee assistance, updates and add methods on request. Although sometimes I could accept some requests.
I just pointed what will be useful to use.
Please check in the update 0.05 the method RemoveLeaf (IDParent As String, Leaf As String) As String you did not point IDParent.

Check event B4XTree_Click (IDBranch As String, LeafName As String)

IdBranch showing IDLeaf
I just think you need a little bit modify structure. everywhere need add IDBranch and IDLeaf

Thank you for your patient and sharing.
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
I just pointed what will be useful to use.
Please check in the update 0.05 the method RemoveLeaf (IDParent As String, Leaf As String) As String you did not point IDParent.

Check event B4XTree_Click (IDBranch As String, LeafName As String)

IdBranch showing IDLeaf
I just think you need a little bit modify structure. everywhere need add IDBranch and IDLeaf

Thank you for your patient and sharing.
As I explained before, I made changes introducing IDLeaf to identify the leaves.I simply had not yet updated the documentation in some places.

Now, to remove a leaf, only IDLeaf must be passed as parameter, and the raised event returns the IDLeaf and the name of the leaf clicked.

Tree or leaf access will not be added in the future through a numeric index as requested by you. This method does not agree with the original data structure inherited from X-Tree.
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
B4J Version: 8.10
Java Version: 8
Parsing code. (0.00s)
Building folders structure. (0.06s)
Compiling code. (0.02s)
Compiling layouts code. (0.01s)
Organizing libraries. (0.00s)
Compiling generated Java code. Error
Cannot find: C:\Program Files\B4J800\B4J\libraries\xui.jar
 

Star-Dust

Expert
Licensed User
Longtime User
B4J Version: 8.10
Java Version: 8
Parsing code. (0.00s)
Building folders structure. (0.06s)
Compiling code. (0.02s)
Compiling layouts code. (0.01s)
Organizing libraries. (0.00s)
Compiling generated Java code. Error
Cannot find: C:\Program Files\B4J800\B4J\libraries\xui.jar
For B4J

 

Star-Dust

Expert
Licensed User
Longtime User
B4J Version: 8.10
Java Version: 8
Parsing code. (0.00s)
Building folders structure. (0.06s)
Compiling code. (0.02s)
Compiling layouts code. (0.01s)
Organizing libraries. (0.00s)
Compiling generated Java code. Error
Cannot find: C:\Program Files\B4J800\B4J\libraries\xui.jar
For B4J

 

andrewmp

Member
Licensed User
Longtime User
Update 0.05
  • The methods for inserting the leaves have changed. Now the leaves require an ID and the raised event returns the ID
  • It is possible to move the leaves in another branch
  • It is possible to update the name and leaf info
  • Add Left,Top,Width,Height parameter

Hi, would you consider modifying the click event like so (or similar) to capture click events on branches as well? :

Private Sub B4XTree1_Click (ID As String, Name As String, IsLeaf as Boolean)
Log($"ID :${ID} Name:${Name}"$)
End Sub

Thanks
 

Star-Dust

Expert
Licensed User
Longtime User
Hi, would you consider modifying the click event like so (or similar) to capture click events on branches as well? :

Private Sub B4XTree1_Click (ID As String, Name As String, IsLeaf as Boolean)
Log($"ID :${ID} Name:${Name}"$)
End Sub

Thanks
Update 0.07

Add Event:
  • ClickBranch (ID As String, Expanded As Boolean)
Add propriety:
  • GetBranchName (IDBranch As String) As String

Sample:
Private Sub B4XTree1_ClickBranch (ID As String, Expanded As Boolean)
    ToastMessageShow($"ID Branch: ${ID}  Branch Name: ${B4XTree1.getBranchName(ID)} Expanded: ${Expanded}"$,True)
End Sub
 

andrewmp

Member
Licensed User
Longtime User
Update 0.07

Add Event:
  • ClickBranch (ID As String, Expanded As Boolean)
Add propriety:
  • GetBranchName (IDBranch As String) As String

Sample:
Private Sub B4XTree1_ClickBranch (ID As String, Expanded As Boolean)
    ToastMessageShow($"ID Branch: ${ID}  Branch Name: ${B4XTree1.getBranchName(ID)} Expanded: ${Expanded}"$,True)
End Sub

Grazie mille , che velocità...
 

Star-Dust

Expert
Licensed User
Longtime User
Update rel 0.08
Add ItemHeight property​
 

Alex_Puz

Member
Licensed User
Longtime User
Update rel 0.08
Add ItemHeight property​
Very nice thank you for share. How about to change text size?
Also if you can add function search parent of branch and leaf, that will be very useful.
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Very nice thank you for share. How about to change text size?
From the Design you can do it, there is the specific Text Size attribute
 

Star-Dust

Expert
Licensed User
Longtime User
At the moment this is not possible. Maybe in a later update
 
Top