B4A Library [B4X] [XUI] AS TextFieldAdvanced - Title, Information, Counter, Password, Button, Prefix, Suffix, Icons, Multiline

With this view you can quickly and easily add good looking text fields, with title and or bottom text. Additionally you can make the TextField a button, so that you can open menus, but still keep the design of the text fields.
The view speeds up development because you don't have to worry about almost anything, it looks nice by default and is functional.

I spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it here by Paypal or with a coffee. :)

In B4J the view does not work properly yet, I am working on fixing the bugs. B4J works now
(21) mage.png


Password strength indicator V1.20+
AS_TextFieldAdvancedStrengthIndicator.gif


Required Fields V1.21+
AS_TextFieldAdvanced Required Fields.gif


Underline Style
AS_TextFieldAdvanced Underline.gif


ComboBox
AS_TextfieldAdvancedComboBoxExample.gif


TitleMode

ASTextFieldAdvanced
Author: Alexander Stolte
Version: 1.23

  • ASTextFieldAdvanced_Counter
    • Fields:
      • CounterMax As Int
      • IgnoreProperties As Boolean
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • TextColor As Int
      • View As ASTextFieldAdvanced_ViewCounter
      • Visible As Boolean
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_Hint
    • Fields:
      • FocusedTextColor As Int
      • IgnoreProperties As Boolean
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • NonFocusedTextColor As Int
      • Text As String
      • View As ASTextFieldAdvanced_ViewHint
      • Visible As Boolean
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_Information
    • Fields:
      • IgnoreProperties As Boolean
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Text As String
      • TextColor As Int
      • View As ASTextFieldAdvanced_ViewInformation
      • Visible As Boolean
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_LeadingIcon
    • Fields:
      • Icon As B4XBitmap
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • View As ASTextFieldAdvanced_ViewLeadingIcon
      • Visible As Boolean
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_Prefix
    • Fields:
      • Gap As Float
      • IgnoreProperties As Boolean
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Text As String
      • TextColor As Int
      • View As ASTextFieldAdvanced_ViewPrefixSuffix
      • Visible As Boolean
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_Suffix
    • Fields:
      • Gap As Float
      • IgnoreProperties As Boolean
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Text As String
      • TextColor As Int
      • View As ASTextFieldAdvanced_ViewPrefixSuffix
      • Visible As Boolean
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_Title
    • Fields:
      • FocusedTextColor As Int
      • Height As Float
      • IgnoreProperties As Boolean
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • NonFocusedTextColor As Int
      • Text As String
      • TextColor As Int
      • View As ASTextFieldAdvanced_ViewTitle
      • Visible As Boolean
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_TrailingIcon
    • Fields:
      • Icon As B4XBitmap
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • View As ASTextFieldAdvanced_ViewTrailingIcon
      • Visible As Boolean
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewCounter
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xlbl_Counter As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewHint
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xlbl_Hint As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewInformation
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xlbl_Information As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewLeadingIcon
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xiv_Icon As B4XView
      • xpnl_Background As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewPrefixSuffix
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xlbl_PrefixSuffix As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewTitle
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xlbl_Title As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewTrailingIcon
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xiv_Icon As B4XView
      • xpnl_Background As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • AS_TextFieldAdvanced
    • Events:
      • ButtonClick
      • ClearButtonClick
      • EnterPressed
      • FocusChanged (HasFocus As Boolean)
      • LeadingIconClick
      • PasswordRevealChanged (Revealed As Boolean)
      • TextChanged (Text As String)
      • TrailingIconClick
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • Class_Globals As String
      • CreateASTextFieldAdvanced_Counter (Visible As Boolean, CounterMax As Int, IgnoreProperties As Boolean, xFont As B4XFont, TextColor As Int, View As ASTextFieldAdvanced_ViewCounter) As ASTextFieldAdvanced_Counter
      • CreateASTextFieldAdvanced_Hint (Visible As Boolean, Text As String, IgnoreProperties As Boolean, FocusedTextColor As Int, NonFocusedTextColor As Int, xFont As B4XFont, View As ASTextFieldAdvanced_ViewHint) As ASTextFieldAdvanced_Hint
      • CreateASTextFieldAdvanced_Information (Visible As Boolean, Text As String, IgnoreProperties As Boolean, xFont As B4XFont, TextColor As Int, View As ASTextFieldAdvanced_ViewInformation) As ASTextFieldAdvanced_Information
      • CreateASTextFieldAdvanced_LeadingIcon (Visible As Boolean, Icon As B4XBitmap, View As ASTextFieldAdvanced_ViewLeadingIcon) As ASTextFieldAdvanced_LeadingIcon
      • CreateASTextFieldAdvanced_Prefix (Visible As Boolean, Text As String, IgnoreProperties As Boolean, xFont As B4XFont, TextColor As Int, Gap As Float, View As ASTextFieldAdvanced_ViewPrefixSuffix) As ASTextFieldAdvanced_Prefix
      • CreateASTextFieldAdvanced_Suffix (Visible As Boolean, Text As String, IgnoreProperties As Boolean, xFont As B4XFont, TextColor As Int, Gap As Float, View As ASTextFieldAdvanced_ViewPrefixSuffix) As ASTextFieldAdvanced_Suffix
      • CreateASTextFieldAdvanced_Title (Visible As Boolean, Text As String, Height As Float, IgnoreProperties As Boolean, xFont As B4XFont, FocusedTextColor As Int, NonFocusedTextColor As Int, View As ASTextFieldAdvanced_ViewTitle) As ASTextFieldAdvanced_Title
      • CreateASTextFieldAdvanced_TrailingIcon (Visible As Boolean, Icon As B4XBitmap, View As ASTextFieldAdvanced_ViewTrailingIcon) As ASTextFieldAdvanced_TrailingIcon
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • Focus As Boolean
        Sets input focus
        Returns True if the focus has shifted
        Always retuns True in B4J
      • FontToBitmap (text As String, IsMaterialIcons As Boolean, FontSize As Float, color As Int) As B4XBitmap
      • getBackgroundColor As Int
      • getBackgroundPanel As B4XView
      • getBottomHeight As Float
        Call Refresh if you change something
      • getButtonTextLabel As B4XView
      • getClearAndRevealButtonColor As Int
        Call Refresh if you change something
      • getClearButtonLabel As B4XView
      • getCounter As ASTextFieldAdvanced_Counter
        Call Refresh if you change something
      • getFocusedShapeColor As Int
      • getHint As ASTextFieldAdvanced_Hint
        Call Refresh if you change something
      • getInformation As ASTextFieldAdvanced_Information
        Call Refresh if you change something
      • getisPasswordMode As Boolean
      • getisRevealed As Boolean
      • getKeyboardType As String
      • getLeadingIcon As ASTextFieldAdvanced_LeadingIcon
        Call Refresh if you change something
      • getLeftGap As Float
        Default: 10dip
        Call Refresh if you change something
      • getMaskText As String
      • getNativeTextField As TextField
        Gets the native TextField view
      • getNativeTextFieldMultiline As TextArea
      • getNativeTextFieldPassword As TextField
        Gets the native TextField view
      • getNonFocusedShapeColor As Int
      • getPrefix As ASTextFieldAdvanced_Prefix
        Call Refresh if you change something
      • getReadOnly As Boolean
        Call Refresh if you change something
      • getRequiredField As Boolean
      • getRequiredFieldColor As Int
      • getRevealButtonLabel As B4XView
      • getShowClearButton As Boolean
        Call Refresh if you change something
      • getShowRevealButton As Boolean
        Call Refresh if you change something
      • getSuffix As ASTextFieldAdvanced_Suffix
        Call Refresh if you change something
      • getText As String
      • getTextField As B4XView
      • getTextFieldCornerRadius As Float
      • getTextFieldMultiline As B4XView
      • getTextFieldPassword As B4XView
      • getTextFull As String
        Gets the full text, with Prefix and Suffix
      • getTitle As ASTextFieldAdvanced_Title
        Call Refresh if you change something
      • getTrailingIcon As ASTextFieldAdvanced_TrailingIcon
        Call Refresh if you change something
      • HideDisplayMissingField As String
        <code>AS_TextFieldAdvanced_1.HideDisplayMissingField</code>
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • PasswordScore As Int
        1 = Weak
        2 = Medium
        3 = Strong
      • Refresh As String
      • setBackgroundColor (Color As Int) As String
      • setBottomHeight (Height As Float) As String
      • setButtonText (Text As String) As String
      • setButtonText2 (Text As String)
        Without TextChanged Event
      • setClearAndRevealButtonColor (Color As Int) As String
      • setFocusedShapeColor (Color As Int) As String
      • setLeftGap (Gap As Float) As String
      • setMaskText (Mask As String) As String
      • setNonFocusedShapeColor (Color As Int) As String
      • setReadOnly (ReadOnly As Boolean) As String
      • setRequiredField (Required As Boolean) As String
        Call Refresh if you change something
      • setRequiredFieldColor (Color As Int) As String
        Call Refresh if you change something
      • setReveale (Revealed As Boolean) As String
      • setShowClearButton (Show As Boolean) As String
      • setShowRevealButton (Show As Boolean) As String
      • setText (Text As String) As String
      • setText2 (Text As String)
        Without TextChanged Event
      • setTextColor (Color As Int) As String
      • setTextFieldCornerRadius (CornerRadius As Float) As String
      • ShowDisplayMissingField (InformationText As String) As String
        Call this function to inform the user that not all required fields are filled in.
        Call HideDisplayMissingField to remove it
        <code>AS_TextFieldAdvanced_1.ShowDisplayMissingField("This field is required")</code>
    • Properties:
      • BackgroundColor As Int
      • BackgroundPanel As B4XView [read only]
      • BottomHeight As Float
        Call Refresh if you change something
      • ButtonText
      • ButtonText2
        Without TextChanged Event
      • ButtonTextLabel As B4XView [read only]
      • ClearAndRevealButtonColor As Int
        Call Refresh if you change something
      • ClearButtonLabel As B4XView [read only]
      • Counter As ASTextFieldAdvanced_Counter [read only]
        Call Refresh if you change something
      • FocusedShapeColor As Int
      • Hint As ASTextFieldAdvanced_Hint [read only]
        Call Refresh if you change something
      • Information As ASTextFieldAdvanced_Information [read only]
        Call Refresh if you change something
      • isPasswordMode As Boolean [read only]
      • isRevealed As Boolean [read only]
      • KeyboardType As String [read only]
      • LeadingIcon As ASTextFieldAdvanced_LeadingIcon [read only]
        Call Refresh if you change something
      • LeftGap As Float
        Default: 10dip
        Call Refresh if you change something
      • MaskText As String
      • NativeTextField As TextField [read only]
        Gets the native TextField view
      • NativeTextFieldMultiline As TextArea [read only]
      • NativeTextFieldPassword As TextField [read only]
        Gets the native TextField view
      • NonFocusedShapeColor As Int
      • Prefix As ASTextFieldAdvanced_Prefix [read only]
        Call Refresh if you change something
      • ReadOnly As Boolean
        Call Refresh if you change something
      • RequiredField As Boolean
        Call Refresh if you change something
      • RequiredFieldColor As Int
        Call Refresh if you change something
      • RevealButtonLabel As B4XView [read only]
      • Reveale
      • ShowClearButton As Boolean
        Call Refresh if you change something
      • ShowRevealButton As Boolean
        Call Refresh if you change something
      • Suffix As ASTextFieldAdvanced_Suffix [read only]
        Call Refresh if you change something
      • Text As String
      • Text2
        Without TextChanged Event
      • TextColor
      • TextField As B4XView [read only]
      • TextFieldCornerRadius As Float
      • TextFieldMultiline As B4XView [read only]
      • TextFieldPassword As B4XView [read only]
      • TextFull As String [read only]
        Gets the full text, with Prefix and Suffix
      • Title As ASTextFieldAdvanced_Title [read only]
        Call Refresh if you change something
      • TrailingIcon As ASTextFieldAdvanced_TrailingIcon [read only]
        Call Refresh if you change something
Changelog
  • 1.00
    • Release
  • 1.01 (read more)
    • Add Designer Property LeadingIcon - An icon which is placed in front of the text and has its own click event
    • Add Designer Property TrailingIcon - An icon which is placed behind the text and has its own click event
    • Add Event LeadingIconClick
    • Add Event TrailingIconClick
    • Add some more properties
  • 1.02
    • Add Type ASTextFieldAdvanced_Title
    • Add Type ASTextFieldAdvanced_Information
    • Add Type ASTextFieldAdvanced_Counter
    • Add Type ASTextFieldAdvanced_Hint
    • Add Type ASTextFieldAdvanced_LeadingIcon
    • Add Type ASTextFieldAdvanced_TrailingIcon
    • Removed some properties, they are now in the new types
    • BugFixes
  • 1.03 (read more)
    • Add Type ASTextFieldAdvanced_Prefix
    • Add Type ASTextFieldAdvanced_Suffix
    • Add Designer Properties Prefix, PrefixText, Suffix, SuffixText
    • Add get TextFull - Gets the full text, with Prefix and Suffix
    • BugFixes
  • 1.04
    • BugFixes
  • 1.05
    • BugFixes
  • 1.06
    • BugFixes
    • Add Designer Property ReadOnly - Disables the user input
      • Default: False
  • 1.07
    • BugFixes
    • Add "Multiline" to the designer property "Mode"
    • New Multiline mode
  • 1.08
    • Multiline BugFixes
  • 1.09
    • Add Focus - Sets input focus
  • 1.10
    • BugFixes
    • get Reveale is renamed to isRevealed
  • 1.11
    • Add Designer Property TextAlignment
      • Default: Left
  • 1.12
    • Add set Text2 - Sets the text, without TextChanged Event
    • Add set ButtonText2 - Sets the button text, without TextChanged Event
  • 1.13
    • BugFixes
  • 1.14
    • ClearButtonClick
  • 1.15
    • BugFix
  • 1.16
    • BugFixes
    • Performance improvements
  • 1.17
    • BugFixes - Character delimiter (Counter = True)
    • B4J Only - Click on the TextField to focus it
  • 1.18
    • BugFix - ReadOnly = True - ClearButton and RevealButton are now also read only
  • 1.19 (read more)
    • Add FocusedShapeColor
      • Default: White with alpha 0 = Transparent
    • Add set TextColor
    • Add Designer Property TextFieldCornerRadius
      • Default: 5dip
    • B4J BugFix - The EnterPressed Event was not triggered
  • 1.20 (read more)
    • BugFixes
    • Add Designer Property StrengthIndicator - Password strength indicator
      • None|Line|Segmented
      • Default: None
  • 1.21 (read more)
    • Add Designer Property RequiredField - if True the field is a required field and is marked with a colored star
      • Default: False
    • Add Designer Property RequiredFieldColor
      • Default: Red
    • Add ShowDisplayMissingField - Call this function to inform the user that not all required fields are filled in
      • Call HideDisplayMissingField to remove it
    • Add HideDisplayMissingField - Removes the user notification from ShowDisplayMissingField
    • Add Designer Property Mask - You can use masks now
      • Default: None
    • Add Designer Property MaskText
      • Example: XXX.XXX.XXX-XX
  • 1.22
    • Add get and set MaskText
  • 1.23
    • BugFixes
    • RevealButton and ClearButton TextColor - Can now also be seen in light mode
    • Add Designer Property ClearAndRevealButtonColor - is per default transparent
      • If the alpha value is set to 0, then a color that matches the background color is automatically used
    • Add Designer Property FocusedTitleTextColor
      • Default: White
    • Add Deigner Property NonFocusedTitleTextColor
      • Default: White
      • Would interfere too much with the design of already existing layouts if another white would be used
    • Add Designer Property NonFocusedShapeColor
  • 1.24
    • Add new Type ASTextFieldAdvanced_TextFieldProperties
    • Properties
      • FocusedShapeColor
      • NonFocusedShapeColor
      • CornerWidth - NEW
      • CornerRadius
  • 1.25
    • BugFixes
  • 1.26
    • BugFixes
  • 1.27
    • BugFixes
  • 1.28
    • Multiline TextFields supports now the clear button
    • The action button have now a fixed HeightWidth = 24dip
  • 1.29
    • BugFixes
  • 1.30
    • Add get and set LeadingWidth
    • Add get and set TrailingWidth
  • 1.31
    • B4A BugFix
  • 1.32
    • Add Designer Property CounterTextColor
      • Default: White
    • Add Designer Property InfoTextColor
      • Default: White
  • 1.33
    • Add Designer Property Underline - A line is visible on the textfield
      • Default: False
      • If true the ShapeColor ist used for this underline
    • Add get UnderlinePanel
  • 1.34
    • BugFix - If ShowRevealButton = True and PasswordField = False - Then the gap was still present at the end of the textfield
  • 1.35
    • BugFix - if you set the Counter or CounterMax, then one emoji is now counting as one
  • 1.36
    • BugFix - The hint text was only renewed if the TextField had no text
    • B4I BugFix - Readonly on Multiline did not work
  • 1.37
    • B4I BugFix - Readonly on Multiline did not work
  • 1.38 (read more)
    • Breaking Change - ButtonText and ButtonText2 have been removed and now work with .Text and .Text2
      • It confuses me every time, especially when I don't know that it's a button
    • A few functions have been made private as they should not be public
    • Button Mode BugFixes
    • Add Mode "ComboBox"
    • Add Event ComboBoxSelectedIndexChanged
    • Add set SetItems
    • Add get and set SelectedIndex
  • 1.39
    • BugFixes
  • 1.40
    • Add get and set TopGap -Same as LeftGap
      • Default: 0
  • 1.41
    • BugFixes
    • Add Designer Property TitleMode
      • Default: Default - Above textfield
      • FloatText - Floating animation like in the B4XFloatTextField
      • BeforeTextField - Show the title before the textfield
    • Add get and set TitleWidth - Works only if the TitleMode is set to BeforeTextField. The Text width of the title
    • Add set TitleWidthAll - Sets the width value for all textfields on the parent
    • Add HorizontalAlignment to the ASTextFieldAdvanced_Title type
      • Default: LEFT
    • Add get and set Underline - Show or hide the underline programmatically
    • Add IndexOf - ComboBox - Returns the index of the item with the given value. Returns -1 if not found.
    • Add get ComboBox - Gets the B4XComboBox
    • Add OpenComboBox
    • Add Event TitleClick
Have Fun :)
 

Attachments

  • AS TextFieldAdvanced Example.zip
    96.5 KB · Views: 1,217
  • AS_TextFieldAdvanced.b4xlib
    15.2 KB · Views: 304
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.19
    • Add FocusedShapeColor
      • Default: White with alpha 0 = Transparent
    • Add set TextColor
    • Add Designer Property TextFieldCornerRadius
      • Default: 5dip
    • B4J BugFix - The EnterPressed Event was not triggered
FocusedShapeColor
Default color is Transparent, so that it does not break anything existing
1684577395627.png

TextFieldCornerRadius
Your TextFields can now look like this:
1684577535010.png
 

Soheyl

Member
Licensed User
Longtime User
The usage of NativeTextField and NativeTextFieldMultiline is resulting in an error.

B4X:
Dim su          As StringUtils
Dim MaximumSize As Int = su.MeasureMultilineTextHeight(AS_TextFieldAdvanced_1.NativeTextFieldMultiline, "Text Size") * 8

log:
java.lang.RuntimeException: Object should first be initialized (B4XView).
 

Alexander Stolte

Expert
Licensed User
Longtime User
The usage of NativeTextField and NativeTextFieldMultiline is resulting in an error.
Works on my machine. Be sure, you set the "Mode" to "Multiline" in the designer, otherwise it is not a multiline textfield!
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.20
    • BugFixes
    • Add Designer Property StrengthIndicator - Password strength indicator
      • None|Line|Segmented
      • Default: None
Multiline Bug
-readonly mode
-text alignment
Works now
StrengthIndicator
Example:
(34) mage.png
 

Lucas Siqueira

Active Member
Licensed User
Longtime User
With this view you can quickly and easily add good looking text fields, with title and or bottom text. Additionally you can make the TextField a button, so that you can open menus, but still keep the design of the text fields.
The view speeds up development because you don't have to worry about almost anything, it looks nice by default and is functional.

I spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it here by Paypal or with a coffee. :)

In B4J the view does not work properly yet, I am working on fixing the bugs. B4J works now
View attachment 131718
Password strength indicator V1.20+
View attachment 142346
ASTextFieldAdvanced
Author: Alexander Stolte
Version: 1.07

  • ASTextFieldAdvanced_Counter
    • Fields:
      • CounterMax As Int
      • IgnoreProperties As Boolean
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • TextColor As Int
      • View As ASTextFieldAdvanced_ViewCounter
      • Visible As Boolean
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_Hint
    • Fields:
      • FocusedTextColor As Int
      • IgnoreProperties As Boolean
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • NonFocusedTextColor As Int
      • Text As String
      • View As ASTextFieldAdvanced_ViewHint
      • Visible As Boolean
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_Information
    • Fields:
      • IgnoreProperties As Boolean
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Text As String
      • TextColor As Int
      • View As ASTextFieldAdvanced_ViewInformation
      • Visible As Boolean
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_LeadingIcon
    • Fields:
      • Icon As B4XBitmap
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • View As ASTextFieldAdvanced_ViewLeadingIcon
      • Visible As Boolean
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_Prefix
    • Fields:
      • Gap As Float
      • IgnoreProperties As Boolean
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Text As String
      • TextColor As Int
      • View As ASTextFieldAdvanced_ViewPrefixSuffix
      • Visible As Boolean
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_Suffix
    • Fields:
      • Gap As Float
      • IgnoreProperties As Boolean
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Text As String
      • TextColor As Int
      • View As ASTextFieldAdvanced_ViewPrefixSuffix
      • Visible As Boolean
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_Title
    • Fields:
      • Height As Float
      • IgnoreProperties As Boolean
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Text As String
      • TextColor As Int
      • View As ASTextFieldAdvanced_ViewTitle
      • Visible As Boolean
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_TrailingIcon
    • Fields:
      • Icon As B4XBitmap
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • View As ASTextFieldAdvanced_ViewTrailingIcon
      • Visible As Boolean
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewCounter
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xlbl_Counter As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewHint
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xlbl_Hint As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewInformation
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xlbl_Information As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewLeadingIcon
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xiv_Icon As B4XView
      • xpnl_Background As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewPrefixSuffix
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xlbl_PrefixSuffix As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewTitle
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xlbl_Title As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • ASTextFieldAdvanced_ViewTrailingIcon
    • Fields:
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • xiv_Icon As B4XView
      • xpnl_Background As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • AS_TextFieldAdvanced
    • Events:
      • ButtonClick
      • EnterPressed
      • FocusChanged (HasFocus As Boolean)
      • LeadingIconClick
      • PasswordRevealChanged (Revealed As Boolean)
      • TextChanged (Text As String)
      • TrailingIconClick
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • Class_Globals As String
      • CreateASTextFieldAdvanced_Counter (Visible As Boolean, CounterMax As Int, IgnoreProperties As Boolean, xFont As B4XFont, TextColor As Int, View As ASTextFieldAdvanced_ViewCounter) As ASTextFieldAdvanced_Counter
      • CreateASTextFieldAdvanced_Hint (Visible As Boolean, Text As String, IgnoreProperties As Boolean, FocusedTextColor As Int, NonFocusedTextColor As Int, xFont As B4XFont, View As ASTextFieldAdvanced_ViewHint) As ASTextFieldAdvanced_Hint
      • CreateASTextFieldAdvanced_Information (Visible As Boolean, Text As String, IgnoreProperties As Boolean, xFont As B4XFont, TextColor As Int, View As ASTextFieldAdvanced_ViewInformation) As ASTextFieldAdvanced_Information
      • CreateASTextFieldAdvanced_LeadingIcon (Visible As Boolean, Icon As B4XBitmap, View As ASTextFieldAdvanced_ViewLeadingIcon) As ASTextFieldAdvanced_LeadingIcon
      • CreateASTextFieldAdvanced_Prefix (Visible As Boolean, Text As String, IgnoreProperties As Boolean, xFont As B4XFont, TextColor As Int, Gap As Float, View As ASTextFieldAdvanced_ViewPrefixSuffix) As ASTextFieldAdvanced_Prefix
      • CreateASTextFieldAdvanced_Suffix (Visible As Boolean, Text As String, IgnoreProperties As Boolean, xFont As B4XFont, TextColor As Int, Gap As Float, View As ASTextFieldAdvanced_ViewPrefixSuffix) As ASTextFieldAdvanced_Suffix
      • CreateASTextFieldAdvanced_Title (Visible As Boolean, Text As String, Height As Float, IgnoreProperties As Boolean, xFont As B4XFont, TextColor As Int, View As ASTextFieldAdvanced_ViewTitle) As ASTextFieldAdvanced_Title
      • CreateASTextFieldAdvanced_TrailingIcon (Visible As Boolean, Icon As B4XBitmap, View As ASTextFieldAdvanced_ViewTrailingIcon) As ASTextFieldAdvanced_TrailingIcon
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • getBackgroundColor As Int
      • getBackgroundPanel As B4XView
      • getBottomHeight As Float
        Call Refresh if you change something
      • getButtonTextLabel As B4XView
      • getClearButtonLabel As B4XView
      • getCounter As ASTextFieldAdvanced_Counter
        Call Refresh if you change something
      • getHint As ASTextFieldAdvanced_Hint
        Call Refresh if you change something
      • getInformation As ASTextFieldAdvanced_Information
        Call Refresh if you change something
      • getisPasswordMode As Boolean
      • getKeyboardType As String
      • getLeadingIcon As ASTextFieldAdvanced_LeadingIcon
        Call Refresh if you change something
      • getLeftGap As Float
        Default: 10dip
        Call Refresh if you change something
      • getNativeTextField As TextField
        Gets the native TextField view
      • getNativeTextFieldMultiline As TextArea
      • getNativeTextFieldPassword As TextField
        Gets the native TextField view
      • getPrefix As ASTextFieldAdvanced_Prefix
        Call Refresh if you change something
      • getReadOnly As Boolean
      • getRevealButtonLabel As B4XView
      • getReveale As Boolean
      • getShowClearButton As Boolean
        Call Refresh if you change something
      • getShowRevealButton As Boolean
        Call Refresh if you change something
      • getSuffix As ASTextFieldAdvanced_Suffix
        Call Refresh if you change something
      • getText As String
      • getTextField As B4XView
      • getTextFieldMultiline As B4XView
      • getTextFieldPassword As B4XView
      • getTextFull As String
        Gets the full text, with Prefix and Suffix
      • getTitle As ASTextFieldAdvanced_Title
        Call Refresh if you change something
      • getTrailingIcon As ASTextFieldAdvanced_TrailingIcon
        Call Refresh if you change something
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Refresh As String
      • setBackgroundColor (Color As Int) As String
      • setBottomHeight (Height As Float) As String
      • setButtonText (Text As String) As String
      • setLeftGap (Gap As Float) As String
      • setReadOnly (ReadOnly As Boolean) As String
      • setReveale (Revealed As Boolean) As String
      • setShowClearButton (Show As Boolean) As String
      • setShowRevealButton (Show As Boolean) As String
      • setText (Text As String) As String
    • Properties:
      • BackgroundColor As Int
      • BackgroundPanel As B4XView [read only]
      • BottomHeight As Float
        Call Refresh if you change something
      • ButtonText
      • ButtonTextLabel As B4XView [read only]
      • ClearButtonLabel As B4XView [read only]
      • Counter As ASTextFieldAdvanced_Counter [read only]
        Call Refresh if you change something
      • Hint As ASTextFieldAdvanced_Hint [read only]
        Call Refresh if you change something
      • Information As ASTextFieldAdvanced_Information [read only]
        Call Refresh if you change something
      • isPasswordMode As Boolean [read only]
      • KeyboardType As String [read only]
      • LeadingIcon As ASTextFieldAdvanced_LeadingIcon [read only]
        Call Refresh if you change something
      • LeftGap As Float
        Default: 10dip
        Call Refresh if you change something
      • NativeTextField As TextField [read only]
        Gets the native TextField view
      • NativeTextFieldMultiline As TextArea [read only]
      • NativeTextFieldPassword As TextField [read only]
        Gets the native TextField view
      • Prefix As ASTextFieldAdvanced_Prefix [read only]
        Call Refresh if you change something
      • ReadOnly As Boolean
      • RevealButtonLabel As B4XView [read only]
      • Reveale As Boolean
      • ShowClearButton As Boolean
        Call Refresh if you change something
      • ShowRevealButton As Boolean
        Call Refresh if you change something
      • Suffix As ASTextFieldAdvanced_Suffix [read only]
        Call Refresh if you change something
      • Text As String
      • TextField As B4XView [read only]
      • TextFieldMultiline As B4XView [read only]
      • TextFieldPassword As B4XView [read only]
      • TextFull As String [read only]
        Gets the full text, with Prefix and Suffix
      • Title As ASTextFieldAdvanced_Title [read only]
        Call Refresh if you change something
      • TrailingIcon As ASTextFieldAdvanced_TrailingIcon [read only]
        Call Refresh if you change something
Changelog
  • 1.00
    • Release
  • 1.01 (read more)
    • Add Designer Property LeadingIcon - An icon which is placed in front of the text and has its own click event
    • Add Designer Property TrailingIcon - An icon which is placed behind the text and has its own click event
    • Add Event LeadingIconClick
    • Add Event TrailingIconClick
    • Add some more properties
  • 1.02
    • Add Type ASTextFieldAdvanced_Title
    • Add Type ASTextFieldAdvanced_Information
    • Add Type ASTextFieldAdvanced_Counter
    • Add Type ASTextFieldAdvanced_Hint
    • Add Type ASTextFieldAdvanced_LeadingIcon
    • Add Type ASTextFieldAdvanced_TrailingIcon
    • Removed some properties, they are now in the new types
    • BugFixes
  • 1.03 (read more)
    • Add Type ASTextFieldAdvanced_Prefix
    • Add Type ASTextFieldAdvanced_Suffix
    • Add Designer Properties Prefix, PrefixText, Suffix, SuffixText
    • Add get TextFull - Gets the full text, with Prefix and Suffix
    • BugFixes
  • 1.04
    • BugFixes
  • 1.05
    • BugFixes
  • 1.06
    • BugFixes
    • Add Designer Property ReadOnly - Disables the user input
      • Default: False
  • 1.07
    • BugFixes
    • Add "Multiline" to the designer property "Mode"
    • New Multiline mode
  • 1.08
    • Multiline BugFixes
  • 1.09
    • Add Focus - Sets input focus
  • 1.10
    • BugFixes
    • get Reveale is renamed to isRevealed
  • 1.11
    • Add Designer Property TextAlignment
      • Default: Left
  • 1.12
    • Add set Text2 - Sets the text, without TextChanged Event
    • Add set ButtonText2 - Sets the button text, without TextChanged Event
  • 1.13
    • BugFixes
  • 1.14
    • ClearButtonClick
  • 1.15
    • BugFix
  • 1.16
    • BugFixes
    • Performance improvements
  • 1.17
    • BugFixes - Character delimiter (Counter = True)
    • B4J Only - Click on the TextField to focus it
  • 1.18
    • BugFix - ReadOnly = True - ClearButton and RevealButton are now also read only
  • 1.19 (read more)
    • Add FocusedShapeColor
      • Default: White with alpha 0 = Transparent
    • Add set TextColor
    • Add Designer Property TextFieldCornerRadius
      • Default: 5dip
    • B4J BugFix - The EnterPressed Event was not triggered
  • 1.20 (read more)
    • BugFixes
    • Add Designer Property StrengthIndicator - Password strength indicator
      • None|Line|Segmented
      • Default: None
Have Fun :)



it would be great if it had mascara, here is a code to add to the class, I tested it on android, and it worked 100%

B4X:
#DesignerProperty: Key: Mask, DisplayName: Mask, FieldType: String, DefaultValue: None, List: None|Left|Right, Description: Where to start the mask.
#DesignerProperty: Key: MaskText, DisplayName: MaskText, FieldType: String, DefaultValue: XXX.XXX.XXX-XX, Description: Mask format use X or 0 to indicate the characters that will be replaced.

Sub Class_Globals
...
    Private m_Mask As String = ""
    Private m_MaskText As String = ""
End Sub

Private Sub IniProps(Props As Map)
...
    m_Mask = Props.GetDefault("Mask","")
    m_MaskText = Props.GetDefault("MaskText","")
End Sub



Private Sub TextChanged(Text As String)
    If m_Mask<>"None" And (m_MaskText.Contains("X") Or m_MaskText.Contains("0"))  Then
        Dim textMasked As String = applyMask(Text, m_MaskText, m_Mask)
        If Text <> textMasked Then 
            xtf_TextField.Text = textMasked
            xtf_TextField.SelectionStart = xtf_TextField.Text.Length
        End If        
    End If

    If g_Counter.Visible Then
        If Text.Length > g_Counter.CounterMax Then
            
            If xtf_TextField.IsInitialized Then 
                Dim SelectionStart As Int = xtf_TextField.SelectionStart
                xtf_TextField.Text = Text.SubString2(0,g_Counter.CounterMax)
                xtf_TextField.SelectionStart = Min(SelectionStart,xtf_TextField.Text.Length)
            End If
            If xtf_TextFieldPassword.IsInitialized Then 
                Dim SelectionStart As Int = xtf_TextFieldPassword.SelectionStart
                xtf_TextFieldPassword.Text = Text.SubString2(0,g_Counter.CounterMax)
                xtf_TextFieldPassword.SelectionStart = Min(SelectionStart,xtf_TextFieldPassword.Text.Length)
            End If
            If xtf_Multiline.IsInitialized Then    
                Dim SelectionStart As Int = xtf_Multiline.SelectionStart
                xtf_Multiline.Text = Text.SubString2(0,g_Counter.CounterMax)
                xtf_Multiline.SelectionStart = Min(SelectionStart,xtf_Multiline.Text.Length)
            End If
            Text = Text.SubString2(0,g_Counter.CounterMax)
        End If
    End If
    
    If Text.Length = 0 Then
        xlbl_ClearButton.Visible = False
        xlbl_RevealButton.Visible = False
        xlbl_Hint.Visible = g_Hint.Visible
    Else
        xlbl_ClearButton.Visible = m_ShowClearButton
        xlbl_RevealButton.Visible = m_PasswordField And m_ShowRevealButton
        xlbl_Hint.Visible = False
    End If
    
    xlbl_Counter.Text = Text.Length & "/" & g_Counter.CounterMax
    TextChanged_Event(Text)
End Sub


Private Sub lettersAndNumbers(Text As String) As String
    Dim enable As String = "abcdefghijklmnopqrstuvwxyzçáãàâäéèêëíìîïóòôõöúùûüçABCDEFGHIJKLMNOPQRSTUVWXYZÁÃÀÂÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÜÇ0123456789"
    
    Dim textClear As StringBuilder
    textClear.Initialize
    For i = 0 To Text.Length-1
        Dim c As String = Text.CharAt(i)
        If enable.Contains(c) Then 
            textClear.Append(c)
        End If        
    Next
    Return textClear.ToString
End Sub

Private Sub applyMask(Text As String, Mask As String, Start As String) As String
    Dim textClear As String = lettersAndNumbers(Text)
    Dim textMasked As StringBuilder
    textMasked.Initialize
    Log(textClear)
    Try
        
        'check how many zeros are in the mask -> verifica quantos zeros tem na mascara
        Dim zeros As Int = 0
        For i = 0 To (Mask.Length-1)
            If Mask.CharAt(i)="0" Then
                zeros = zeros + 1
            End If
        Next
        
        If zeros > 0 Then
            If IsNumber(textClear) Then
                textClear = textClear.As(Long)
            End If
        End If
        
        'if there are more zeros in the mask than characters in the text, add zeros to the text, until you get the number of zeros in the mask -> caso tem mais zeros na mascara do que caracteres no texto, adiciona zeros ao texto, até dar a quantidade de zeros da mascara
        If zeros > textClear.Length Then
            textClear = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & textClear
            textClear = textClear.SubString(textClear.Length-zeros)
        End If
        
        If Start="Left" Then
            For i = 1 To Mask.Length
                Dim c As Char = Mask.CharAt(i-1)
                If (c="X" And textClear.Length>0) Or (c="0" And textClear.Length>0) Then
                    Dim t As Char = textClear.CharAt(0)'get the last character -> pega o ultimo caracter
                    textClear = textClear.SubString(1)'remove the last character -> remove o ultimo caracter
                    textMasked.Append(t)
                Else
                    If c="X" Or textClear.Length=0 Then
                        Exit
                    End If
                    textMasked.Append(c)
                End If
            Next
            
        Else If Start="Right" Then
            For i = Mask.Length To 1 Step -1
                Dim c As Char = Mask.CharAt(i-1)
                If (c="X" And textClear.Length>0) Or (c="0" And textClear.Length>0) Then
                    Dim t As Char = textClear.CharAt(textClear.Length-1)'get the last character -> pega o ultimo caracter
                    textClear = textClear.SubString2(0,textClear.Length-1)'remove the last character -> remove o ultimo caracter
                    textMasked.Insert(0, t)
                Else
                    If c="X" Or textClear.Length=0 Then
                        Exit
                    End If
                    textMasked.Insert(0, c)
                End If
            Next
        End If
    Catch
        Log(LastException)
    End Try
    Log(textMasked.ToString)
    Return textMasked.ToString
End Sub
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.21
    • Add Designer Property RequiredField - if True the field is a required field and is marked with a colored star
      • Default: False
    • Add Designer Property RequiredFieldColor
      • Default: Red
    • Add ShowDisplayMissingField - Call this function to inform the user that not all required fields are filled in
      • Call HideDisplayMissingField to remove it
    • Add HideDisplayMissingField - Removes the user notification from ShowDisplayMissingField
    • Add Designer Property Mask - You can use masks now
      • Default: None
    • Add Designer Property MaskText
      • Example: XXX.XXX.XXX-XX
Special thanks to @Lucas Siqueira for his code in #67 for the mask feature.

RequiredFields
Call the function "ShowDisplayMissingField" to show the user he has to fill something. Call the "HideDisplayMissingField" function to remove it
1685801828392.png

Mask
When the user types something, the text view automatically formats it into the correct format
1685802014332.png

AS_TextFieldAdvanced Mask Example.gif
 

PumaCyan

Member
Licensed User
Mask
When the user types something, the text view automatically formats it into the correct format
1686800893016.png

Can the mask property be enabled via code?
such as :

Sample Code:
Private Sub AS_TextFieldAdvanced_TextChanged(Text As String)
    If Text. Length = 4 Then
        AS_TextFieldAdvanced. mask = "X.XXX"
    Else If Text. Length = 7 then
        AS_TextFieldAdvanced.mask = "X.XXX.XXX"
    End If
End Sub
 

Lucas Siqueira

Active Member
Licensed User
Longtime User
Two other suggestions for improvements:

1) icon color (xlbl_ClearButton, xlbl_RevealButton) if the background is light and if the background is dark.
(using the code Alexandre Stolte: https://www.b4x.com/android/forum/threads/b4x-check-if-color-is-dark-or-light.110463/)

1.1) add code below isColorDark;
1.2) modify DesignerCreateView;
B4X:
...
xlbl_ClearButton.TextColor = IIf(isColorDark(m_BackgroundColor),xui.Color_ARGB(152,255,255,255),xui.Color_ARGB(152,0,0,0))
...
xlbl_RevealButton.TextColor = xlbl_ClearButton.TextColor
...

B4X:
Private Sub isColorDark(color As Int) As Boolean
    Dim res(4) As Int
    res(0) = Bit.UnsignedShiftRight(Bit.And(color, 0xff000000), 24)
    res(1) = Bit.UnsignedShiftRight(Bit.And(color, 0xff0000), 16)
    res(2) = Bit.UnsignedShiftRight(Bit.And(color, 0xff00), 8)
    res(3) = Bit.And(color, 0xff)
    
    Dim darkness As Int = 1 - (0.299 * res(1) + 0.587 * res(2) + 0.114 * res(3))/255
    
    If darkness <= 0.5 Then
        Return False 'It's a light color
    Else
        Return True 'It's a dark color
    End If
End Sub



2) add FocusedTitleTextColor and NonFocusedTitleTextColor as it is fixed to white color.
2.1) add properties in designer FocusedTitleTextColor and NonFocusedTitleTextColor;
2.2) modify the IniProps sub for g_Title to receive the FocusedTitleTextColor and NonFocusedTitleTextColor parameters;
2.3) modify the sub CreateASTextFieldAdvanced_Title to receive the new parameters FocusedTitleTextColor and NonFocusedTitleTextColor;
2.4) modify the Style sub to validate m_HasFocus = true, to define the title color using the new parameters FocusedTitleTextColor and NonFocusedTitleTextColor;


B4X:
...
#DesignerProperty: Key: FocusedTitleTextColor, DisplayName: Focused Title Text Color, FieldType: Color, DefaultValue: 0xFFFFFFFF, Description: You can use the built-in color picker to find the color values.
#DesignerProperty: Key: NonFocusedTitleTextColor, DisplayName: Non Focused Title Text Color, FieldType: Color, DefaultValue: 0x64FFFFFF, Description: You can use the built-in color picker to find the color values.
...

Private Sub IniProps(Props As Map)
...
g_Title = CreateASTextFieldAdvanced_Title(Props.Get("Title"),Props.Get("TitleText"),DipToCurrent(Props.Get("TitleHeight")),False,xui.CreateDefaultBoldFont(15),xui.PaintOrColorToColor(Props.Get("FocusedTitleTextColor")),xui.PaintOrColorToColor(Props.Get("NonFocusedTitleTextColor")),CreateASTextFieldAdvanced_ViewTitle(xlbl_Title))
...
End Sub
...


Private Sub Style
    '****************View Properties*******************************
    'Title Options
    If g_Title.IgnoreProperties = False Then
        xlbl_Title.Text = g_Title.Text
        If m_HasFocus Then
            xlbl_Title.TextColor = g_Title.FocusedTextColor
            Log(g_Title.FocusedTextColor)
        Else
            xlbl_Title.TextColor = g_Title.NonFocusedTextColor
            Log(g_Title.NonFocusedTextColor)
        End If
        xlbl_Title.Font = g_Title.xFont
        xlbl_Title.SetTextAlignment("CENTER","LEFT")
        
        xlbl_TitleReqiredField.Text = "*"
        xlbl_TitleReqiredField.Textcolor = m_RequiredFieldColor
        xlbl_TitleReqiredField.Font = g_Title.xFont
        xlbl_TitleReqiredField.SetTextAlignment("CENTER","LEFT")
        
    End If
...
End Sub


...
Public Sub CreateASTextFieldAdvanced_Title (Visible As Boolean, Text As String, Height As Float, IgnoreProperties As Boolean, xFont As B4XFont, FocusedTextColor As Int, NonFocusedTextColor As Int, View As ASTextFieldAdvanced_ViewTitle) As ASTextFieldAdvanced_Title e tambem modifique o type ASTextFieldAdvanced_Title
    Dim t1 As ASTextFieldAdvanced_Title
    t1.Initialize
    t1.Visible = Visible
    t1.Text = Text
    t1.Height = Height
    t1.IgnoreProperties = IgnoreProperties
    t1.xFont = xFont
    t1.FocusedTextColor = FocusedTextColor
    t1.NonFocusedTextColor = NonFocusedTextColor
    t1.View = View
    Return t1
End Sub

1687050019439.png
 

Attachments

  • AS_TextFieldAdvanced.bas
    66.1 KB · Views: 152

jahswant

Well-Known Member
Licensed User
Longtime User
How to set the hint programatically ! Setting it with AS_TextFieldAdvanced_4.Hint.View.xlbl_Hint.Text = is distorting the view.
Never Mind had to call :

AS_TextFieldAdvanced_4.Refresh
 
Last edited:

cobra666

Member
Licensed User
Longtime User
Got a request.

now u have to use designer to set keyboard type. can u make the option to use code to change it.

and found something strange.

When u use corner radius(base background) and u forget to change TextfieldCornerradius then i get this

issue.png


maybe remove TextfieldCornerradius and background color(custom properties) and let Base Background handle the colors/radius
 

Alexander Stolte

Expert
Licensed User
Longtime User
hey @Alexander Stolte could you add option to cahange the reveal label color ? In the official lib ?
But then the change would be invalid to automatically adjust the text color when using a light design. in #71
When u use corner radius(base background) and u forget to change TextfieldCornerradius then i get this
Please use the provided function to change the corner radius.
B4X:
AS_TextFieldAdvanced_1.TextFieldCornerRadius = 10dip
maybe remove TextfieldCornerradius and background color(custom properties) and let Base Background handle the colors/radius
Why should I do that? There are properties provided for this purpose that you should use.
 

cobra666

Member
Licensed User
Longtime User
But then the change would be invalid to automatically adjust the text color when using a light design. in #71

Please use the provided function to change the corner radius.
B4X:
AS_TextFieldAdvanced_1.TextFieldCornerRadius = 10dip

Why should I do that? There are properties provided for this purpose that you should use.

They both do the same thing. thats why i suggested it :)
 

fbritop

Active Member
Licensed User
Longtime User
Do you have an example of using CreateASTextFieldAdvanced_Hint?

Thanks
FBP
 

Alexander Stolte

Expert
Licensed User
Longtime User
Do you have an example of using CreateASTextFieldAdvanced_Hint?
CreateASTextFieldAdvanced_Hint is an intern function. If you want o change hint properties, then do this:
B4X:
AS_TextFieldAdvanced_1.Hint.Text = "Test"
AS_TextFieldAdvanced_1.Refresh
 

fbritop

Active Member
Licensed User
Longtime User
CreateASTextFieldAdvanced_Hint is an intern function. If you want o change hint properties, then do this:
B4X:
AS_TextFieldAdvanced_1.Hint.Text = "Test"
AS_TextFieldAdvanced_1.Refresh
Thanks!
If it is an intern function, should it be kept as "Private" so it does not appears in the intellisense?
 

Daica

Active Member
Licensed User
I'm trying to make the textfield look something like this:
1689113469336.png


Not sure how I can do that? I've been messing with the designer settings and I just can't get it to look anything like that.

I set the border, which is good.
But when I set the background color to white, it just becomes invisible.
I dont think there is a "Non Focused Shape Color" or a border color
 
Top