iOS Question Question about the B4XComboBox and B4XFloatTextField

Alex_197

Well-Known Member
Licensed User
Longtime User
Hi all.

In my app I need to do a validation of the information entered by user and if something is wrong I want to highlight it.

I tried to change color by this way

B4X:
B4XComboBox.mBase.TextColor=Colors.Red
B4XFloatTextField.Color=Colors.Red

It doesn't work.

Is there any other option?

Thanks.
 
Solution
Seems to work fine with B4XComboBox:

1769611750335.png


B4X:
SetButtonTextColor(B4XComboBox1.mBtn, xui.Color_Red, 0)
B4XComboBox1.mBase.SetColorAndBorder(xui.Color_Green, 2dip, xui.Color_Blue, 2dip)


'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

Alex_197

Well-Known Member
Licensed User
Longtime User
You can use B4XFloatTextField.mBase.SetColorAndBorder to change the border to red or something similar. Also for B4XComboBox.

B4XComboBox, in B4i, has a mBtn view, which you can access and change its text color.

Thank you for your reply.

For B4XFloatTextField.mBase.SetColorAndBorder - works fine.

For B4XComboBox - it does nothing.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Seems to work fine with B4XComboBox:

1769611750335.png


B4X:
SetButtonTextColor(B4XComboBox1.mBtn, xui.Color_Red, 0)
B4XComboBox1.mBase.SetColorAndBorder(xui.Color_Green, 2dip, xui.Color_Blue, 2dip)


'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
 
Upvote 0
Solution

Alex_197

Well-Known Member
Licensed User
Longtime User
Seems to work fine with B4XComboBox:

View attachment 169591

B4X:
SetButtonTextColor(B4XComboBox1.mBtn, xui.Color_Red, 0)
B4XComboBox1.mBase.SetColorAndBorder(xui.Color_Green, 2dip, xui.Color_Blue, 2dip)


'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
Thanks, will try.
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
Seems to work fine with B4XComboBox:

View attachment 169591

B4X:
SetButtonTextColor(B4XComboBox1.mBtn, xui.Color_Red, 0)
B4XComboBox1.mBase.SetColorAndBorder(xui.Color_Green, 2dip, xui.Color_Blue, 2dip)


'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
It works perfectly, thanks.
 
Upvote 0
Top