Hello,
I like to localize the button text of a b4xDialog. At this moment I have the problem that the button text will not be shown complete.
I think I have to measure the text and I have to set the buttons width accordingly. I used several snippeds from the forum like:
But this will not work correct. Any Idea how to display the text complete or how to stretch the button width depending on its text?
I like to localize the button text of a b4xDialog. At this moment I have the problem that the button text will not be shown complete.
I think I have to measure the text and I have to set the buttons width accordingly. I used several snippeds from the forum like:
B4X:
Private Sub MeasureTexWidth(Text As String,ThisFont As Font) As Double
Dim TextObj As JavaObject
TextObj.InitializeNewInstance("javafx.scene.text.Text",Array(Text))
TextObj.RunMethod("setFont",Array(ThisFont))
TextObj.RunMethod("applyCss",Null)
Dim Bounds As JavaObject
Bounds = TextObj.RunMethodJO("getLayoutBounds",Null)
Log(Bounds.RunMethod("getWidth",Null))
Return Bounds.RunMethod("getWidth",Null)
End Sub
But this will not work correct. Any Idea how to display the text complete or how to stretch the button width depending on its text?