B4A Library CharCounter

This library will allow you to add a character counter to EditTexts.

The counter can be ascending or descending.


Requirements:

1- Copy the CharCounter.jar and CharCounter.xml to your additional libraries directory.


Usage:
B4X:
'Initialize the library
Dim Ascending As CharCounter

'Add the counter to an EditText
Ascending.Initialize(Activity, EditText1, 10, "A", "L", "Length: ")


'Add this line to the TextChanged event (in this sample, EditText1)
Sub EditText1_TextChanged(Old As String, New As String)

    Ascending.Update(Old, New)

End Sub

That's it.

A sample project is attached.
 

Attachments

  • CharCounter_Project.zip
    10.6 KB · Views: 449
  • CharCounter_Lib_1.0.zip
    3.4 KB · Views: 470
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Nice:

upload_2013-12-31_8-43-3.png
 

cds-soft

Member
Licensed User
Longtime User
Thanks for this. Should be the posibility to hide the prompt? If i pass "" or Null it still appear. I'm ussing this in a scrollview, and the prompt is not attached with the edit and doesn't scroll with it. Thanks.
 

cds-soft

Member
Licensed User
Longtime User
How are you initializing the EditTexts?, do you have a small sample code for me to try?, if you do, please attach the ZIP file to a post.
Well, it's a big project now, so I have to make a simple example. This weekend.
Now i make the charcounter not visible and it's enough from now.
Thanks for your reply.
 
Top