B4A Library [B4X] [XUI] SD_TreeList

Download a Library from Here

SD_TreeList

Author:
Star-Dust
Version: 0.15
  • 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
      • Add2 (Name As String, IDBranch As String, Symbol As String, FontSymbol As B4XFont, Color As Int, ListLeaf As String()) As String
      • AddBranch (Name As String, IDBranch As String, IDParent As String, FontAwesoneSymbol As String, Color As Int) As String
      • AddBranch2 (Name As String, IDBranch As String, IDParent As String, Symbol As String, FontSymbol As B4XFont, Color As Int) As String
      • AddBranchDoubleSymbol (Name As String, IDBranch As String, IDParent As String, OpenSymbol As String, CloseSymbol As String, FontSymbol As B4XFont, Color As Int) As String
      • AddDoubleSymbol (Name As String, IDBranch As String, OpenSymbol As String, CloseSymbol As String, FontSymbol As B4XFont, Color As Int, ListLeaf As String()) As String
      • AddLeaf (Name As String, Info As String, IDBLeaf As String, IDParent As String) As String
      • AddLeafOnTop (Name As String, Info As String, IDLeaf As String, IDBranch As String) As String
      • 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.
      • 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:

Daica

Member
Licensed User
I don't know if it's too much work, but could I donate to add those features and you can release the update for the community?

From running the example, tapping on the badge causes the app to error
1623770535999.png
 

Star-Dust

Expert
Licensed User
I don't know if it's too much work, but could I donate to add those features and you can release the update for the community?

From running the example, tapping on the badge causes the app to error
View attachment 114979
I will verify the error.

You can also use the command to make the colored bar disappear
B4X:
B4XTree1.OnlyCornerColor = True
 

Star-Dust

Expert
Licensed User
The Bugs has been fixed. Thank you for the report.
I added two new methods that give the possibility to have an icon for the open branch and one for the close branch.

Update 0.15
  • Fix Bugs
  • Added AddBranchDoubleSymbol and AddDoubleSymbol
    With this new method it will be possible to have an icon with the open branch and a different icon for the closed branch (the symbol can be a character of a font of your choice, eg. FontAwesone)
ezgif.com-gif-maker.gif


From now on the libraries for all platforms can only be downloaded from this link
 
Last edited:

Daica

Member
Licensed User
The Bugs has been fixed. Thank you for the report.
I added two new methods that give the possibility to have an icon for the open branch and one for the close branch.

From now on the libraries for all platforms can only be downloaded from this link
Amazing.

I noticed in your first post, there is spacing between branches in the earlier versions. is this still possible with the new version?
preview-2-gif.85100


Running the example from your first post:
1623773293520.png


Thanks for your work, going to send some coffee money your way haha
 

Star-Dust

Expert
Licensed User
Amazing.

I noticed in your first post, there is spacing between branches in the earlier versions. is this still possible with the new version?
preview-2-gif.85100


Running the example from your first post:
View attachment 114988

Thanks for your work, going to send some coffee money your way haha
It was a bug that has been fixed
 

Star-Dust

Expert
Licensed User
Dang, I thought it was a feature LOL. It looks kind of nice with the gap and lighter brand color, makes it easier on the eyes to split the group up haha
The source has since been rewritten. Before each branch was placed inside a panel, now this is no longer the case to allow some animations.
So now it is not possible to color a background because it does not exist with the current code.

It is also not easy to reduce the thickness of the colored bar for some technical reasons. It would complicate the code too much, so I suggest you put it transparent and framed.
 

Daica

Member
Licensed User
The source has since been rewritten. Before each branch was placed inside a panel, now this is no longer the case to allow some animations.
So now it is not possible to color a background because it does not exist with the current code.

It is also not easy to reduce the thickness of the colored bar for some technical reasons. It would complicate the code too much, so I suggest you put it transparent and framed.

Understood. Thank you for this awesome library, love your work
 

Star-Dust

Expert
Licensed User
Update 0.16
  • Fix Bugs
 

Daica

Member
Licensed User
Hi @Star-Dust , not sure if this is a "bug", but setting the the text size to anything higher than 18, the Leaf text starts to get cut off.

Here is an example with textSize set to 20
1623864248785.png
 

Star-Dust

Expert
Licensed User
Hi @Star-Dust , not sure if this is a "bug", but setting the the text size to anything higher than 18, the Leaf text starts to get cut off.

Here is an example with textSize set to 20
View attachment 115040
The height of the leaf is less than that of the branch. Note that it can contain two lines.. Use a smaller font size or increase staff height

Would it be possible to add badges to the Branch as well?
It is not planned to add this function
 
Last edited:

Alex_Puz

Member
Licensed User
I love this library, thanks. May I suggest something that would be helpful?
1 If you delete a branch, then it would be logical to delete all branches and leaves under this branch.
2 Ability to install a badge on a branch.
 

Star-Dust

Expert
Licensed User
we will see in the future if it is possible​
 
Top