Public Sub Initialize (Callback As Object, EventName As String)
Prepare the instance before its other methods.
Original catalog note: Initializes the component
ELEVATEUI · B4A · XUI
Validated inputs, helper messages, text counters and password entry.
Inputs & forms
Validated inputs, helper messages, text counters and password entry.
Animated conceptual demonstration, not an exact Android control screenshot.
Validate an email or required field as the user types and present a useful helper message beside it.
Before integrating, examine its methods, events and Designer options.
Tutorials are based on existing project examples or audited APIs. Check each example’s prerequisites; B4A compilation is not claimed.
Review required libraries, Designer views and input data before compiling in B4A.
Sub Globals
Private NameInput As UIEditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
NameInput.Initialize(Me, "Name")
NameInput.AddToParent(Activity, "name", "Your name", _
16dip, 32dip, 100%x - 32dip, 64dip, _
0xFF10B981, 0xFFF1F5F9, 0xFF0F172A, False, True)
NameInput.setRequiredField(True)
NameInput.setMaxLength(80)
NameInput.setShowCounter(True)
NameInput.setHelperText("Enter your full name")
End Sub
Private Sub ValidateName
Dim value As String = NameInput.Text.Trim
If value.Length = 0 Then
NameInput.setError("This field is required")
Else
NameInput.clearError
Log(value)
End If
End Sub
Review required libraries, Designer views and input data before compiling in B4A.
' Tras inicializar una UIEditText:
NameInput.setInputType("Email")
NameInput.setHintText("Email address")
NameInput.setMaxLength(120)
' Para un campo independiente de contraseña:
' PasswordInput.setPasswordMode(True)
' PasswordInput.setPasswordStrength(True)
' PasswordInput.setShowIcon(True)
' PasswordInput.setReadOnly(False)
68 audited signatures
Public Sub Initialize (Callback As Object, EventName As String)
Prepare the instance before its other methods.
Original catalog note: Initializes the component
Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
Invoked automatically by the B4A Visual Designer; do not call manually.
Original catalog note: Creates the view in the designer
Public Sub AddToParent(parent As B4XView, ViewTag As Object, Hinttext As String, Left As Int, Top As Int, WidthView As Int, HeightView As Int, activecolor As Int, backgound As Int, textColor As Int, passmode As Boolean, staticmode As Boolean)
Add this view to a parent container using the supplied bounds and options.
Original catalog note: Adds the component to a parent view
Public Sub Base_Resize (Width As Double, Height As Double)
Use Base_Resize for its named operation; follow its exact signature.
Original catalog note: Resizes the component
Public Sub Activate(Active As Boolean)
Use Activate for its named operation; follow its exact signature.
Original catalog note: Enable or disable the search view
Public Sub setActiveColor(Color As Int)
Update active color at runtime when this setting changes.
Public Sub setIconPanelBackgroundColor(color As Int)
Update icon panel background color at runtime when this setting changes.
Public Sub setBackgroundColor(Color As Int)
Update background color at runtime when this setting changes.
Public Sub setText(texto As String)
Update text at runtime when this setting changes.
Public Sub setTextColor(TextColor As Int)
Update text color at runtime when this setting changes.
Public Sub setTextSize(txtsize As Int)
Update text size at runtime when this setting changes.
Public Sub setHintColor(color As Int)
Update hint color at runtime when this setting changes.
Public Sub setHintTextColor(color As Int)
Update hint text color at runtime when this setting changes.
Public Sub getHintTextColor As Int
Read the current hint text color value for validation or UI synchronization.
Returns: Int
Public Sub setPasswordStrength(Enabled As Boolean)
Update password strength at runtime when this setting changes.
Public Sub getPasswordStrength As Boolean
Read the current password strength value for validation or UI synchronization.
Returns: Boolean
Public Sub setPasswordMode(Enabled As Boolean)
Update password mode at runtime when this setting changes.
Public Sub getPasswordMode As Boolean
Read the current password mode value for validation or UI synchronization.
Returns: Boolean
Public Sub setShowIcon(Visible As Boolean)
Update show icon at runtime when this setting changes.
Public Sub getShowIcon As Boolean
Read the current show icon value for validation or UI synchronization.
Returns: Boolean
Public Sub setHintAsTitle(Enabled As Boolean)
Update hint as title at runtime when this setting changes.
Public Sub getHintAsTitle As Boolean
Read the current hint as title value for validation or UI synchronization.
Returns: Boolean
Public Sub setHintText(Hint_txt As String)
Update hint text at runtime when this setting changes.
Public Sub setIconDeleteColor(IconeColor As Int)
Update icon delete color at runtime when this setting changes.
Public Sub setIconColor(Color As Int)
Update icon color at runtime when this setting changes.
Public Sub getIconColor As Int
Read the current icon color value for validation or UI synchronization.
Returns: Int
Public Sub setIconSize(Size As Int)
Update icon size at runtime when this setting changes.
Public Sub getIconSize As Int
Read the current icon size value for validation or UI synchronization.
Returns: Int
Public Sub setCornerRadius(CornerRadii As Int)
Update corner radius at runtime when this setting changes.
Public Sub setFont(Fonts As B4XFont)
Update font at runtime when this setting changes.
Public Sub setIcon(font As B4XFont, Icons As String, color As Int)
Update icon at runtime when this setting changes.
Public Sub setlogo(filedir As String, filename As String)
Update logo at runtime when this setting changes.
Public Sub setRequiredField(Enabled As Boolean)
Update required field at runtime when this setting changes.
Original catalog note: === New Setters: Required Field ===
Public Sub getRequiredField As Boolean
Read the current required field value for validation or UI synchronization.
Returns: Boolean
Public Sub setRequiredFieldColor(color As Int)
Update required field color at runtime when this setting changes.
Public Sub getRequiredFieldColor As Int
Read the current required field color value for validation or UI synchronization.
Returns: Int
Public Sub setHelperText(text As String)
Update helper text at runtime when this setting changes.
Original catalog note: === New Setters: Helper Text ===
Public Sub getHelperText As String
Read the current helper text value for validation or UI synchronization.
Returns: String
Public Sub setHelperTextColor(color As Int)
Update helper text color at runtime when this setting changes.
Public Sub getHelperTextColor As Int
Read the current helper text color value for validation or UI synchronization.
Returns: Int
Public Sub setMaxLength(length As Int)
Update max length at runtime when this setting changes.
Original catalog note: === New Setters: Counter ===
Public Sub getMaxLength As Int
Read the current max length value for validation or UI synchronization.
Returns: Int
Public Sub setShowCounter(Enabled As Boolean)
Update show counter at runtime when this setting changes.
Public Sub getShowCounter As Boolean
Read the current show counter value for validation or UI synchronization.
Returns: Boolean
Public Sub setInputType(typeName As String)
Update input type at runtime when this setting changes.
Original catalog note: === New Setters: Input Type ===
Public Sub getInputType As String
Read the current input type value for validation or UI synchronization.
Returns: String
Public Sub setReadOnly(readOnlyMode As Boolean)
Update read only at runtime when this setting changes.
Original catalog note: === New Setters: Read Only ===
Public Sub getReadOnly As Boolean
Read the current read only value for validation or UI synchronization.
Returns: Boolean
Public Sub setMultiline(Enabled As Boolean)
Update multiline at runtime when this setting changes.
Public Sub getMultiline As Boolean
Read the current multiline value for validation or UI synchronization.
Returns: Boolean
Public Sub setErrorColor(color As Int)
Update error color at runtime when this setting changes.
Original catalog note: === New Setters: Error Color ===
Public Sub getErrorColor As Int
Read the current error color value for validation or UI synchronization.
Returns: Int
Public Sub getNativeEditText As EditText
Read the current native edit text value for validation or UI synchronization.
Returns: EditText
Public Sub GetNativeTextField As TextField
Use GetNativeTextField for its named operation; follow its exact signature.
Returns: TextField
Public Sub getText As String
Read the current text value for validation or UI synchronization.
Returns: String
Public Sub getActiveColor As Int
Read the current active color value for validation or UI synchronization.
Returns: Int
Public Sub getBackgroundColor As Int
Read the current background color value for validation or UI synchronization.
Returns: Int
Public Sub getTextColor As Int
Read the current text color value for validation or UI synchronization.
Returns: Int
Public Sub getTextSize As Int
Read the current text size value for validation or UI synchronization.
Returns: Int
Public Sub getHintColor As Int
Read the current hint color value for validation or UI synchronization.
Returns: Int
Public Sub getHintText As String
Read the current hint text value for validation or UI synchronization.
Returns: String
Public Sub getIsError As Boolean
Read the current is error value for validation or UI synchronization.
Returns: Boolean
Public Sub getErrorText As String
Read the current error text value for validation or UI synchronization.
Returns: String
Public Sub setError(ErrorMessage As String)
Update error at runtime when this setting changes.
Original catalog note: Sets an error state: changes border, hint, and helper text to error color with the given message
Public Sub clearError
Use clearError for its named operation; follow its exact signature.
Original catalog note: Clears the error state: restores all colors to normal
Public Sub Wait(Duration As Long)
Use Wait for its named operation; follow its exact signature.
Public Sub RefreshView
Use RefreshView for its named operation; follow its exact signature.
Public Sub SetIconGlow(Radius As Float, GlowColor As Int)
Use SetIconGlow for its named operation; follow its exact signature.
Original catalog note: Applies a glowing shadow effect to the left icon label of the UIEditText
#DesignerProperty: Key: ActiveColor, DisplayName: Active Color, FieldType: Color, DefaultValue: 0xff35B998, Description: Active Color#DesignerProperty: Key: CornerRadius, DisplayName: Corner Radius, FieldType: Int, DefaultValue: 100, MinRange: 0, MaxRange: 100, Description: Corner radius of the search view.#DesignerProperty: Key: IconPanelBackgroundColor, DisplayName: Icon Panel Background Color, FieldType: Color, DefaultValue: 0xFF35B998, Description: Background color of the icon panel.#DesignerProperty: Key: BackgroundColor, DisplayName: Background Color, FieldType: Color, DefaultValue: 0x38FFF8F8, Description: Background Color#DesignerProperty: Key: TextColor, DisplayName: Text Color, FieldType: Color, DefaultValue: 0xff12153D, Description: Text Color#DesignerProperty: Key: HintColor, DisplayName: mHint Color, FieldType: Color, DefaultValue: 0x3212153D, Description: mHint Color#DesignerProperty: Key: IconDeleteColor, DisplayName: Icon Delete Color, FieldType: Color, DefaultValue: 0xFFD9747E, Description: Icon Delete Color#DesignerProperty: Key: IconColor, DisplayName: Icon Color, FieldType: Color, DefaultValue: 0xFFFFFFFF, Description: Left Icon Color#DesignerProperty: Key: HintText, DisplayName: mHint Text, FieldType: String, DefaultValue: , Description: mHint Text#DesignerProperty: Key: TextSize, DisplayName: Text Size, FieldType: Int, DefaultValue: 14, MinRange: 0, MaxRange: 100, Description: Text Size#DesignerProperty: Key: IconSize, DisplayName: Icon Size, FieldType: Int, DefaultValue: 18, MinRange: 0, MaxRange: 100, Description: Icon Size#DesignerProperty: Key: BorderWidth, DisplayName: BorderWidth, FieldType: Int, DefaultValue: 4, MinRange: 0, MaxRange: 100, Description: BorderWidth#DesignerProperty: Key: StaticMode, DisplayName: BarMode, FieldType: Boolean, DefaultValue: True, Description: Static bar mode.#DesignerProperty: Key: mPasswordMode, DisplayName: Password Mode, FieldType: Boolean, DefaultValue: False, Description: Password Mode.#DesignerProperty: Key: PasswordStrength, DisplayName: Password Strength Validator, FieldType: Boolean, DefaultValue: True, Description: Enable Password Strength Indicator.#DesignerProperty: Key: mShowIcon, DisplayName: Show Left Icon, FieldType: Boolean, DefaultValue: True, Description: Show Left Icon Panel.#DesignerProperty: Key: mMultiline, DisplayName: mMultiline, FieldType: Boolean, DefaultValue: False, Description: mMultiline Mode.#DesignerProperty: Key: HintAsTitle, DisplayName: Hint As Title, FieldType: Boolean, DefaultValue: False, Description: Hint is always displayed as a normal placeholder.#DesignerProperty: Key: RequiredField, DisplayName: Required Field, FieldType: Boolean, DefaultValue: False, Description: Shows a colored star indicator for required fields.#DesignerProperty: Key: RequiredFieldColor, DisplayName: Required Field Color, FieldType: Color, DefaultValue: 0xFFDD5F60, Description: Color of the required field star.#DesignerProperty: Key: HelperText, DisplayName: Helper Text, FieldType: String, DefaultValue: , Description: Helper text shown below the field.#DesignerProperty: Key: HelperTextColor, DisplayName: Helper Text Color, FieldType: Color, DefaultValue: 0x6412153D, Description: Color of the helper text.#DesignerProperty: Key: MaxLength, DisplayName: Max Length, FieldType: Int, DefaultValue: 0, MinRange: 0, MaxRange: 10000, Description: Maximum text length (0 = unlimited).#DesignerProperty: Key: ShowCounter, DisplayName: Show Counter, FieldType: Boolean, DefaultValue: False, Description: Show character counter below the field.#DesignerProperty: Key: InputType, DisplayName: Input Type, FieldType: String, DefaultValue: Text, List: Text|Number|Phone|Email|Decimal, Description: Keyboard input type.#DesignerProperty: Key: ReadOnly, DisplayName: Read Only, FieldType: Boolean, DefaultValue: False, Description: Makes the field read-only.Initialize with Me and the event prefix Demo, then add the following handler to your B4A module. Names and arguments come from the library declaration.
Raised when a selection or value changes; use it to update dependent data.
B4A handler signature with Demo prefix
Private Sub Demo_TextChanged(Old As String, New As String)
Log("TextChanged")
End Sub
Raised when a selection or value changes; use it to update dependent data.
B4A handler signature with Demo prefix
Private Sub Demo_FocusChanged(HasFocus As Boolean)
Log("FocusChanged")
End Sub
Event declared by this module. Handle the indicated action in the callback.
B4A handler signature with Demo prefix
Private Sub Demo_EnterPressed()
Log("EnterPressed")
End Sub
Raised when the user taps the control; use it to trigger a real action.
B4A handler signature with Demo prefix
Private Sub Demo_ClickedIcon(open As Boolean)
Log("ClickedIcon")
End Sub
For code-created controls use Initialize(Me, "Demo") when that signature exists; for Designer controls set the event name there. Replace Demo with the actual prefix.
Public mBase As B4XView ' Base view for the componentPublic Tag As Object ' Tag for the componentPublic isActive As Boolean = False ' Active state flagPublic Widthh As Int ' Width of the componentPublic Hightt As Int ' Height of the componentPublic Const INPUT_TYPE_TEXT As String = "Text"Public Const INPUT_TYPE_NUMBER As String = "Number"Public Const INPUT_TYPE_PHONE As String = "Phone"Public Const INPUT_TYPE_EMAIL As String = "Email"Public Const INPUT_TYPE_DECIMAL As String = "Decimal"