B4J Question BreadCrumbBar settings

micro

Well-Known Member
Licensed User
Longtime User
Hi to all
How i can set for individual item the various properties?
Text color, background color, image ecc.
Thanks.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Not so simple but is possible:

SS-2018-05-16_10.05.25.png


Code:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   MainForm.RootPane.LoadLayout("1") 'Load the layout file.
   MainForm.Show
   #if RELEASE
   Dim jo As JavaObject = BreadCrumbBar1
   Dim callback As Object = jo.CreateEvent("javafx.util.Callback", "bcb", Null)
   jo.RunMethod("setCrumbFactory", Array(callback))
   #end if
   BreadCrumbBar1.SetItems(Array("1", "2", "3"))
End Sub

Sub bcb_Event (MethodName As String, Args() As Object) As Object
   Dim crumb As TreeItem = Args(0)
   Dim jo As JavaObject
   Dim btn As Button = jo.InitializeNewInstance("impl.org.controlsfx.skin.BreadCrumbBarSkin.BreadCrumbButton", Array(crumb.Text))
   Select btn.Text
       Case "1"
           btn.TextColor = fx.Colors.Red
       Case "2"
           btn.TextColor = fx.Colors.From32Bit(0xFF187C00)
       Case "3"
           btn.TextColor = fx.Colors.Blue
   End Select
   btn.TextSize = 30
   Return btn
End Sub

Note that the callback is only set in release mode as it will not work properly in debug mode.
 
Upvote 0
Top