B4J Question Text color for MenuBar

micro

Well-Known Member
Licensed User
Longtime User
Hi
I have a small problem with text color:

B4X:
mb.Style = "-fx-font-size: 18;" & "-fx-font-weight: normal;" & "-fx-text-fill: #000000;" & "-fx-background-color:linear-gradient(To top, white, #3c7fb1);"

mb is a MenuBar, only a text color of menubar not work, it is always white.
Why?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
SS-2014-02-02_08.58.02.png


You should create a css file and put it in the Files folder:
B4X:
.menu .label {
   -fx-text-fill: red;
}

.menu-item .label {
   -fx-text-fill: red;

}
In your code:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   MainForm.RootPane.LoadLayout("1") 'Load the layout file.
   MainForm.Show
   MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "tb.css")) 'tb.css is the css file.
End Sub
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
Another question...
how do I change the label width for item menu?
or even better, label autosize for the content?
Thanks
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
in fact
on a PC autosize works fine but on a PC with a 24 inch monitor the text is truncated
 
Upvote 0
Top