B4A Library [B4X] [XUI] SD_TreeList

Download a Library from Here

SD_TreeList

Author:
Star-Dust
Version: 0.27
  • B4XTree
    • Events:
      • Click (IDLeaf As String, LeafName As String)
      • ClickBranch (ID As String, Expanded As Boolean)
      • LongRightClick (IDLeaf As String, LeafName As String)
      • LongRightClickBranch (ID As String, BranchName 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
      • AddLeaf2 (Name As String, Info As String, Note As String, IDBLeaf As String, IDParent As String) As String
        Add Leaf to branch
      • AddLeaf3 (Name As String, Info As String, Note As String, FontNote As B4XFont, ColorNote As Int, IDBLeaf As String, IDParent As String, FontAwesoneSymbol As String, FontSymbol As B4XFont) As String
        Add Leaf with info, note andSymbol to branch
      • AddLeaf3OnTop (Name As String, Info As String, Note As String, FontNote As B4XFont, ColorNote As Int, IDBLeaf As String, IDBranch As String, FontAwesoneSymbol As String, FontSymbol As B4XFont) As String
        Add Leaf with info,note and Symbol to branch on top
      • AddLeafOnTop (Name As String, Info As String, IDLeaf As String, IDBranch As String) As String
        Add Leaf on top to Branch
      • AddLeafwithSymbol (Name As String, Info As String, IDBLeaf As String, IDParent As String, FontAwesoneSymbol As String, FontSymbol As B4XFont) As String
        Add Leaf with Symbol to branch
      • AddLeafwithSymbolOnTop (Name As String, Info As String, IDBLeaf As String, IDBranch As String, FontAwesoneSymbol As String, FontSymbol As B4XFont) As String
        Add Leaf with Symbol to branch on top
      • 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
      • GetLeafBadgeActive (IDLeaf As String) As Boolean
      • GetLeafBadgeText (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
      • InfoTextSize 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
This is a first text of the changes I meant. It is a question of recalling the drawing function recursively. For the moment I removed the back panel to help the recursion method.

I don't know if you can see clearly from the image, but the animation loses a lot and there is the risk that moving ever further to the right ends up off-screen

Preview 2.gif
Preview 3.gif
 

Unobtainius

Active Member
Licensed User
Longtime User
Genius. I have no idea how you did it, but its great! Keep up the excellent work Star-Dust
 

Star-Dust

Expert
Licensed User
Longtime User

Alex_Puz

Member
Licensed User
Longtime User
This is a first text of the changes I meant. It is a question of recalling the drawing function recursively. For the moment I removed the back panel to help the recursion method.

I don't know if you can see clearly from the image, but the animation loses a lot and there is the risk that moving ever further to the right ends up off-screen

View attachment 85351 View attachment 85352
This is a first text of the changes I meant. It is a question of recalling the drawing function recursively. For the moment I removed the back panel to help the recursion method.

I don't know if you can see clearly from the image, but the animation loses a lot and there is the risk that moving ever further to the right ends up off-screen

View attachment 85351 View attachment 85352

Cool! How to set up some custom icon for a branch. Could you provide some code?
 

Star-Dust

Expert
Licensed User
Longtime User
in the example you will find the code. for the icon used in font of tawesone to be inserted as a parameter to the AddBranch method
 

Alex_Puz

Member
Licensed User
Longtime User
The idea is that of having it as property.
It's a simple thing to do but I'm off site I don't know if I can do it today
When you expect done "branch inside branch"? I am going to make some project then can use it.
 

Star-Dust

Expert
Licensed User
Longtime User
I've already done it, I've included several new features, but I don't have the time to prepare the documentation to publish it. I hope in the coming weeks.

It will be possible to have leaves with 2 lines of Label to insert information under the name of the leaf. When the branches are opened the branch names will be in bold. And it has the method put on top for both the leaves and the branches
 
Last edited:

Alex_Puz

Member
Licensed User
Longtime User
I've already done it, I've included several new features, but I don't have the time to prepare the documentation to publish it. I hope in the coming weeks.

It will be possible to have leaves with 2 lines of Label to insert information under the name of the leaf. When the branches are opened the branch names will be in bold. And it has the method put on top for both the leaves and the branches
Great! If possible send me sample code and library i will try and let you know ASAP
 

Star-Dust

Expert
Licensed User
Longtime User
When I can I will put the library and the example on this thread so you and others can try it. At the moment I am implementing it on my App and therefore it is being perfected.
 

Star-Dust

Expert
Licensed User
Longtime User
Only veetically. As you can see in the video
 

Star-Dust

Expert
Licensed User
Longtime User
How to programmatically set up size and position of sd Tree List?
I forgot to enter GetBase
For the moment put it inside a Panel and set TreeList anchored for all 4 sides to 0Dip.

When you change the panel you will also change TreeList, obviously you have to call Invalidate.

Or wait for the next update.
 

Alex_Puz

Member
Licensed User
Longtime User
I forgot to enter GetBase
For the moment put it inside a Panel and set TreeList anchored for all 4 sides to 0Dip.

When you change the panel you will also change TreeList, obviously you have to call Invalidate.

Or wait for the next update.
thks, Noted
 

Alex_Puz

Member
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
 
Last edited:
Top