iOS Question Problem with Font.CreateNew2

Filippo

Expert
Licensed User

Filippo

Expert
Licensed User
This is how the OS behaves. What are you trying to do?
I think I found the error, the "NewButton" procedure was not correct.
B4X:
Dim btn1 As Button = NewButton("00:00:00.00", 12, Font.CreateNew2("ArialMT", 30), "")
Log("btn1.CustomLabel.Font.Name=" & btn1.CustomLabel.Font.Name)
    
Dim btn2 As Button
btn2.Initialize("", btn2.STYLE_SYSTEM)
btn2.CustomLabel.font = btn1.CustomLabel.font
Log("btn2.CustomLabel.Font.Name=" & btn2.CustomLabel.Font.Name)

Private Sub NewButton(Text As String, TextSize As Int, TextFont As Font, Event As String) As Button
    Dim btn As Button
    btn.Initialize(Event, btn.STYLE_SYSTEM)
    btn.SetBorder(1, Colors.Black, 3)
    'btn.CustomLabel.Font = TextFont.CreateNew(TextSize) 'Create wrong Fontname
    btn.CustomLabel.Font = TextFont.CreateNew2(TextFont.Name, TextSize) 'Create correct Fontname
    btn.Text = Text
    Return btn
End Sub

Log:
btn1.CustomLabel.Font.Name=ArialMT
btn2.CustomLabel.Font.Name=ArialMT
 
Upvote 0
Top