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

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.28
    • Multiline TextFields supports now the clear button
    • The action button have now a fixed HeightWidth = 24dip
On the other hand, ClearButton does not have the same alignment with TextField and TextFieldMultiLine, I could not figure it out digging into the library
is fixed now, i want a update image
 

fbritop

Active Member
Licensed User
Longtime User
Update
  • 1.28
    • Multiline TextFields supports now the clear button
    • The action button have now a fixed HeightWidth = 24dip

is fixed now, i want a update image
Now it is aligned, thanks!

The other issue, when the textbox contains text, althow it calls the refresh method, the hint continues to display behind. If the text changes after the initial setup, then the hint dissapears.
I did solved with (Line 630 aprox).


B4X:
    If g_Hint.IgnoreProperties = False Then
        If m_HasFocus Then
            xlbl_Hint.TextColor = g_Hint.FocusedTextColor
        Else
            xlbl_Hint.TextColor = g_Hint.NonFocusedTextColor
        End If
        xlbl_Hint.Font = g_Hint.xFont
        xlbl_Hint.Text = IIf(g_Hint.Visible,g_Hint.Text,"")
        If m_Mode = "Multiline" Then
            xlbl_Hint.SetTextAlignment("TOP",m_TextAlignment)
        End If
        If xtf_Multiline.IsInitialized Then text=xtf_Multiline.Text '<---New
        If xtf_TextField.IsInitialized Then text=xtf_TextField.Text '<---New
        If xtf_TextFieldPassword.IsInitialized Then text=xtf_TextFieldPassword.Text '<---New
        g_Hint.Visible=(text.length=0) '<---New
    End If

Same thing with the clear button if there is text present, it wont show, which I resolved by calling in Sub Style to call the TextChanged function at the end:

B4X:
    xpnl_TextFieldBackground.SetColorAndBorder(m_BackgroundColor,g_TextFieldProperties.BorderWidth,IIf(m_HasFocus,g_TextFieldProperties.FocusedShapeColor,g_TextFieldProperties.NonFocusedShapeColor),g_TextFieldProperties.CornerRadius)

    sleep(0)
    If xtf_TextField.IsInitialized Then TextChanged(xtf_TextField.Text)
    If xtf_TextFieldPassword.IsInitialized Then TextChanged(xtf_TextFieldPassword.Text)
    If xtf_Multiline.IsInitialized Then TextChanged(xtf_Multiline.Text)   
End Sub
 

Alexander Stolte

Expert
Licensed User
Longtime User
The other issue, when the textbox contains text, althow it calls the refresh method, the hint continues to display behind. If the text changes after the initial setup, then the hint dissapears.
I cannot reproduce the error. But I'm not satisfied with your solution either, so I don't want to add this blindly.
The variable "text" does not exist at all at this point.
 

fbritop

Active Member
Licensed User
Longtime User
I understand, it is just an aproach to fulfill mi requierments...
text comes from a little up (I forgot to include it, line 630 aprox)

B4X:
    'Hint Options
    Dim text as String=""
    If g_Hint.IgnoreProperties = False Then
        If m_HasFocus Then
            xlbl_Hint.TextColor = g_Hint.FocusedTextColor
        Else
            xlbl_Hint.TextColor = g_Hint.NonFocusedTextColor
        End If
        xlbl_Hint.Font = g_Hint.xFont
        xlbl_Hint.Text = IIf(g_Hint.Visible,g_Hint.Text,"")
        
        If m_Mode = "Multiline" Then
            xlbl_Hint.SetTextAlignment("TOP",m_TextAlignment)
        End If
        
        If xtf_Multiline.IsInitialized Then text=xtf_Multiline.Text
        If xtf_TextField.IsInitialized Then text=xtf_TextField.Text
        If xtf_TextFieldPassword.IsInitialized Then text=xtf_TextFieldPassword.Text
        g_Hint.Visible=(text.length=0)
    End If
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.29
    • BugFixes
I found a bug, in the ClearButton_Click event I called the TextChanged function too early before I made the text empty. And in another place something was wrong with the hint. If it still occurs now, I ask you for an example project. I would already know why.
 

fbritop

Active Member
Licensed User
Longtime User
Out of town right now. I will check it out as soon as I get back to mi home
Thanks
 

jahswant

Well-Known Member
Licensed User
Longtime User
Please could you check on B4I ? When yoy type the forst word the hint is not wiped.
 

Alexander Stolte

Expert
Licensed User
Longtime User

Sandman

Expert
Licensed User
Longtime User
I think two elements are hard-coded to always be white: Information and Counter. It would be nice if they too could be set in the Designer.
 

Alexander Stolte

Expert
Licensed User
Longtime User
I think two elements are hard-coded to always be white: Information and Counter. It would be nice if they too could be set in the Designer.
They are not hard coded.
B4X:
AS_TextFieldAdvanced1.Counter.TextColor = xui.Color_Black
AS_TextFieldAdvanced1.Information.TextColor = xui.Color_Black
AS_TextFieldAdvanced1.Refresh
 

Sandman

Expert
Licensed User
Longtime User
I think I've found a bug affecting B4i. The TextChanged event is called twice, first with the current text, then with the previous text. (Or perhaps with the current one, minus the last char.)

This can be verified using the example project, by adding this code:
B4X:
Private Sub AS_TextFieldAdvanced_1_TextChanged(Text As String)
    Log(Text)
End Sub

Typing 123 gives this log:
B4X:
1
(empty string)
12
1
123
12

I had a look at the library code, but it wasn't obvious to me what the problem could be - sorry.
 

Alexander Stolte

Expert
Licensed User
Longtime User
I think I've found a bug affecting B4i. The TextChanged event is called twice, first with the current text, then with the previous text. (Or perhaps with the current one, minus the last char.)
Unfortunately, this is a simulator bug that I have no influence on, as I simply pass on the native event.
 

Sandman

Expert
Licensed User
Longtime User
Ah, thanks. And just to be super clear: This is only seen in the simulator, so I should not be worried it will show up in real devices?
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 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
Underline
Now the following style is possible:

 

Sandman

Expert
Licensed User
Longtime User
I think I've found a minor bug. If you enable the counter and enter an emoji into the field, it's counted as two characters. It should probably still be counted as one, even though it consumes two bytes.

(I imagine some unicode characters can take more than two bytes.)
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…