iOS Question B4xFloatTextLabel setting appearance by code

Gianni Sassanelli

Active Member
Licensed User
Longtime User
Hi as by subject,
is ther any way to change appearance of B4xFloatTextLabel sub views by code

I need for example to increase space betwheen label (hint) and field as in above screen shot (PAD equivalent of B4A)
also I would like change font style
 
Last edited:

Gianni Sassanelli

Active Member
Licensed User
Longtime User
You can set HintLabelLargeOffsetX, HintLabelSmallOffsetY and HintLabelSmallOffsetX.

Make sure to call B4XFloatTextField.Update after modifying these fields.
don't solve because HintLabelSmallOffsetY move only the label but i want to move the textfield
with B4A i do
B4X:
 fld.TextField.Padding = Array As Int (5dip,5dip,0dip,0dip)
but in B4I is not supported
 
Upvote 0

Gianni Sassanelli

Active Member
Licensed User
Longtime User
Sorry Erel,
but this is what I need

1629212055333.png
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
1) If B4XFloatTextField is Multiline, B4i uses a TextView.

In this case it's possible https://developer.apple.com/documentation/uikit/uitextview/1618619-textcontainerinset

B4X:
Dim no As NativeObject = B4XFloatTextField1.TextField
no.RunMethod("setTextContainerInset:", Array (no.MakeEdgeInsets (8, 0, 8, 0)))

Of course, change standard values.

2) If B4XFloatTextField is Singleline, B4i uses a TextField.
In this case it's possible to use leftView and rightView properties.
For example:
B4X:
#If OBJC
- (void) setInsets : (UITextField *) textField : (int) paddingLeft : (int) paddingRight
    {
    textField.leftView      = [[UIView alloc] initWithFrame: CGRectMake (0, 0,  paddingLeft,  0)];
    textField.rightView     = [[UIView alloc] initWithFrame: CGRectMake (0, 0,  paddingRight, 0)];
    textField.leftViewMode  = UITextFieldViewModeAlways;
    textField.rightViewMode = UITextFieldViewModeAlways;
}
#End If

Call
B4X:
Dim no As NativeObject = Me
no.RunMethod ("setInsets:::", Array (B4XFloatTextField2.TextField, 50, 75))
 
Last edited:
Upvote 0
Top