B4A Library [B4X] [XUI] [B4XLib] SD TextView

I needed to develop a modern editText (or TextField), but different from the B4XFloatTextField, different in terms of graphics and style. So I created the SD_TextView
(see also xComboBox)

NOTE: You can use this library for personal and commercial use. Include it in your projects.. Attention, even if it is a B4XLib library, it is not allowed to decompress it, modify it, change its name or redistribute it without the permission of the author

SD_TextView

Author:
Star-Dust
Version: 0.22
  • SD_IconTextView
    • Events:
      • EnterPressed
      • FocusChanged (HasFocus As Boolean)
      • HintClick
      • TextChanged (OldText As String, Newtext As String)
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • GetBase As B4XView
      • Initialize (Callback As Object, EventName As String)
    • Properties:
      • Hint As String
      • HintFont As B4XFont
      • NativeObject As TextField [read only]
      • Text As String
      • TextFont As B4XFont
  • SD_TextView
    • Events:
      • EnterPressed
      • FocusChanged (HasFocus As Boolean)
      • TextChanged (OldText As String, Newtext As String)
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • GetBase As B4XView
      • Initialize (Callback As Object, EventName As String)
      • SetHintColor (HintTextColor As Int, HintBackGroundColor As Int)
      • SetTextViewColor (TextColor As Int, BackGroundColor As Int, Corner_Color As Int)
    • Properties:
      • AnimateHint As Boolean
      • Hint As String
      • HintFont As B4XFont
      • NativeObject As TextField [read only]
      • Text As String
      • TextFont As B4XFont
  • SD_TwoIconTextView
    • Events:
      • Click
      • EnterPressed
      • FocusChanged (HasFocus As Boolean)
      • HintClick
      • TextChanged (OldText As String, Newtext As String)
      • Unfocus
    • Fields:
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • GetBase As B4XView
      • Initialize (Callback As Object, EventName As String)
    • Properties:
      • Hint As String
      • HintFont As B4XFont
      • NativeObject As TextField [read only]
      • Text As String
      • TextConfirmButton As String
        Char fontAwesone
      • TextFont As B4XFont
  • SD_UnderLineTextView
    • Events:
      • EnterPressed
      • FocusChanged (HasFocus As Boolean)
      • TextChanged (OldText As String, Newtext As String)
    • Fields:
      • ExpansionTime As Int
      • mBase As B4XView
      • Tag As Object
    • Functions:
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • GetBase As B4XView
      • Initialize (Callback As Object, EventName As String)
      • UnderLine (Show As Boolean)
    • Properties:
      • Hint As String
      • HintFont As B4XFont
      • NativeObject As TextField [read only]
      • Text As String
      • TextFont As B4XFont

1605734557938.png


1605734432742.png


Video.gif
Underline1.gif


1645032504598.png
1645129052006.png
 

Attachments

  • Sample B4i.zip
    110.6 KB · Views: 423
  • 1597673547592.png
    1597673547592.png
    20.7 KB · Views: 1,319
  • Sample B4J.zip
    2.5 KB · Views: 383
  • Sample B4A.zip
    8.3 KB · Views: 601
  • SD_TextView.B4xLib
    9.2 KB · Views: 96
Last edited:

Star-Dust

Expert
Licensed User
sorry, i do not understand what you mean
 

Star-Dust

Expert
Licensed User
It's just a typo. It is version 0.09 although I have not updated the number in the release,
 

Star-Dust

Expert
Licensed User
In the current version there is no customization of the send button. Maybe it could be in the future
 

Star-Dust

Expert
Licensed User
Update rel. 0.11
  • Add new View: UnderlineTextView
Underline1.gif


It is possible to make the line appear when the view is created or when it is in focus. Attached an example
 

Attachments

  • Sample2.zip
    8 KB · Views: 162

Star-Dust

Expert
Licensed User
Update rel. 0.12
Add HintClick event on IconTextView​
Add HintClick event on TowIconTextView​
The event will be raised when the hint icon is clicked​
 
Last edited:

Rubsanpe

Active Member
Licensed User
Hi. I think I have encountered a small problem. When the hint text is longer it increases a lot the space before and after the text, and it looks misaligned with the other controls.

Captura.PNG


Rubén
 

Star-Dust

Expert
Licensed User
It is not a bug,

A label with rounded edges is created for the hint and the text is centered on this label, not right aligned.

1614408993339.png

1614409052778.png


However download version 0.14 that this difference has been reduced
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Since the label is aligned to left, align its text to left too; or, better, provide a property to set its alignment ;)
 

Star-Dust

Expert
Licensed User
Since the label is aligned to left, align its text to left too; or, better, provide a property to set its alignment ;)
This is not exactly the case. The label can be aligned left or right as desired. The text always in the center
 

glupinacci

Member
Licensed User
Update rel. 0.11
  • Add new View: UnderlineTextView
View attachment 104909

It is possible to make the line appear when the view is created or when it is in focus. Attached an example
Update rel. 0.11
  • Add new View: UnderlineTextView
View attachment 104909

It is possible to make the line appear when the view is created or when it is in focus. Attached an example
Hello! Awesome work! Is this image from B4a? how do you change the cursor color as shown?
 

Star-Dust

Expert
Licensed User
I'm sorry but I haven't changed the color of the slider. It is a theme effect in the android manifest. You can change cursor color using native procedures applied to native view which you can get with the NativeObject property
 

Mashiane

Expert
Licensed User
Longtime User
Hi SD...

Can you please advise, this does not work well..

B4X:
Sub PreProcessSDText(sdtext As SD_IconTextView, hintIcon As Object, hint As String)
    sdtext.HintFont = xui.CreateMaterialIcons(30)
    sdtext.Hint = hintIcon
    sdtext.NativeObject.HintText = hint
    sdtext.NativeObject.KeyboardType = sdtext.NativeObject.TYPE_DEFAULT
End Sub

Usage..

B4X:
PreProcessSDText(txtCity, Chr(0xE7F1), "City")

Perhaps I'm missing something.... or maybe I should leave out the keyboard part.
 

Star-Dust

Expert
Licensed User
Hi SD...

Can you please advise, this does not work well..

B4X:
Sub PreProcessSDText(sdtext As SD_IconTextView, hintIcon As Object, hint As String)
    sdtext.HintFont = xui.CreateMaterialIcons(30)
    sdtext.Hint = hintIcon
    sdtext.NativeObject.HintText = hint
    sdtext.NativeObject.KeyboardType = sdtext.NativeObject.TYPE_DEFAULT
End Sub

Usage..

B4X:
PreProcessSDText(txtCity, Chr(0xE7F1), "City")

Perhaps I'm missing something.... or maybe I should leave out the keyboard part.
I didn't quite understand what is not working well and which class you are writing about

This is the expected behavior. By Hint we mean the icon (if you use FontAwesone) or the text (if you use a normal font) enclosed in the drop.
While if you want the traditional hint you have to access the native property.
 
Last edited:
Top