B4A Library Mask V1.0.0

Mask

This is a wrapper for this github project.

Version:
1
  • MaskEditText
    Methods:
    • Initialize (EventName As String, edit As EditText, mask As String)
    • Mask (format As String, text As String) As String
    • unMask (s As String) As String



B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private EditText1 As EditText
    Private EditText2 As EditText
    Private mask As MaskEditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    mask.Initialize("Mask",EditText1,"##.##.##.##.##")
    mask.Initialize("Mask",EditText2,"(##)####-#######")
End Sub
 

Attachments

  • MaskEx.zip
    7.1 KB · Views: 833
  • libMaskV1.0.0.zip
    4.1 KB · Views: 982
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
hi @DonManfred
i will try use this lib, and obvius if works donate for this.

i have a question, its possible add space? i need show a number like this on the edittext
(51) 99999-9999

have a space later )

thx
 

DonManfred

Expert
Licensed User
Longtime User

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I have been using MaskEditText for sometime and today during testing I found I believe a bug in it.

Everything is up to date B4A 8.3, SDK 27, Java jdk1.8.0_181

I create MaskEditText for one of my fields in my createscreen routine (mask is for IP address ###.###.###.###)

It seems if I have to recall the MaskEditText.Initialize routine again (redrawing screen) and then try to assign it some data to the field major recursion crash (in MaskEditText code).

Right now I have replaced it with MaskedEditText library and when I have some time I will try and make a small program showing this.

Just an FYI if someone is crashing might be the problem.

BobVal
 

Guenter Becker

Active Member
Licensed User
Mask

This is a wrapper for this github project.

Version: 1
  • MaskEditText
    Methods:
    • Initialize (EventName As String, edit As EditText, mask As String)
    • Mask (format As String, text As String) As String
    • unMask (s As String) As String



B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private EditText1 As EditText
    Private EditText2 As EditText
    Private mask As MaskEditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    mask.Initialize("Mask",EditText1,"##.##.##.##.##")
    mask.Initialize("Mask",EditText2,"(##)####-#######")
End Sub

I like this nice feature but for us in Germany we need to have the possbility to change the comma and thousands identifier. As you know European (Metric) people use instead of the dot a comma for the digit devider and instead of a comma a dot for a thousands devider.
For this it would be a neccessary feature to have the declaration of this mask elements as a prop for example mask.comma = "," and mask.thousands = ".".
Yet I know that I can put this in the mask but using it on a (German) device masking will not work if I use comma as digit divider.
If you have no time to update the lib please public the class code and I will look if I can do it for you.
 
Top