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 = Font.CreateNew(TextSize)
btn.Text = Text
Return btn
End Sub
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 = Font.CreateNew(TextSize)
btn.CustomLabel.TextColor = Colors.Green
btn.Color = Colors.Red
btn.Text = Text
Return btn
End Sub
btnascolta.Initialize("btnascolta",btnascolta.STYLE_SYSTEM)
btnascolta.Text = "ASCOLTA"
btnascolta.SetBorder(1, Colors.Black, 3)
btnascolta.CustomLabel.Font = Font.CreateNew(20)
btnascolta.CustomLabel.TextColor = Colors.Red
btnascolta.Color = Colors.Yellow
Sub ButtonDanish_Click
ButtonDanish.Color = Colors.RGB(51,153,255)
ButtonDanish.CustomLabel.TextColor = Colors.White
End Sub
Private Sub Button1_Click
Button1.Color = Colors.Red
Button1.CustomLabel.TextColor = Colors.White
Button2.Color = Colors.Red
Button2.CustomLabel.TextColor = Colors.White
End Sub
The property is read-only. The label itself is not read-only.How can I Customize the label if it is Read Only?
'state: 0 = normal, 1 = pressed, 2 = disabled
Sub SetButtonTextColor(btn As Button, clr As Int, state As Int)
Dim no As NativeObject = btn
no.RunMethod("setTitleColor:forState:", Array(no.ColorToUIColor(clr), state))
End Sub
SetButtonTextColor(Button1, Colors.Grean, 1)