B4A Library [Lib] Masked EditText

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Everyone,

My app has multiple Masked EditText views going across the screen. It has an address view 1, an address view 2 which are side by side. And under the address view is a city view, a state view, and a zip view which is also side by side.

Is there a way to control which Masked EditText view will receive focus when the "Next" button is tapped on the keyboard?

What happens now is tapping the "Next" button on the keyboard jumps from address view 1 to the state view instead of jumping over to address view 2.

Sometimes the "Done" button on the keyboard is displayed instead of the "Next" button when focus is on the first Masked EditText view. This is intermittent I think.

Thanks.
 

Informatix

Expert
Licensed User
Longtime User
The behavior is exactly the same as for a standard EditText. Any method that works for an EditText will work for a MET. You should modify this class to allow the use of MaskedEditText and see whether that works for you.
 

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Rusty and Informatix,

I tried it and it worked like a dream.
 

Informatix

Expert
Licensed User
Longtime User
[This is not a criticism of this excellent library]

As a user, I can not easily enter an email address.
There's not a lot of options. Either you enter it without a mask (it's what you do with a basic edittext), or you enter it with a mask and I agree that's not much better. You can enter it in two separate fields too. It's probably what I would do.

Is it better to use a simple EditText (or this View but unformatted)?
MaskedEditText has a few advantages over EditText that are listed at the beginning of the first thread.
 

compilador

New Member
Licensed User
Longtime User
Hello Informatix, I'm trying out your lib. I can add a MaskedEtitText by code but it isn't shown in the "Add View" list at the designer. Do I have to do something else to add your view to the designer?
I have B4A ver. 5.02

Thanks
 

Dave O

Well-Known Member
Licensed User
Longtime User
Hi there,

I'm trying out MET to replace normal editText fields because I want to show validation errors using the ShowError method.

So far so good - it was easy to drop in a MET field as a replacement and set a few properties.

The only difference I've noticed so far is that, when a field is disabled, the text color does not dim (e.g. from black to a shade of gray if I'm using Holo Light).

I can manually set the textColor whenever I enable/disable the field, but is there a reason it doesn't do this automatically like the stock editText view?

Merci!
 

Informatix

Expert
Licensed User
Longtime User
??? If I set Enabled to False, the color changes to a dimmed shade. I didn't add/change anything to the standard behavior.
 

Dave O

Well-Known Member
Licensed User
Longtime User
??? If I set Enabled to False, the color changes to a dimmed shade. I didn't add/change anything to the standard behavior.

Hmm, strange. On the devices I've tried (Samsung Note 3, emulated Nexus S and Nexus 9), the disabled text is not dimmed (although the bottom line of the view is). And I'm not touching the textColor value in the designer or in the code.

If you can't reproduce it, I'll upload a minimal example so you can check if it behaves differently on your devices.

Merci encore
 

Dave O

Well-Known Member
Licensed User
Longtime User
Noticed another strange behaviour, perhaps related: If I disable a MET in the designer, it is still enabled when the app runs.

(If I disable it in code, then it does disable.)

I will post a minimal example tomorrow if I get a chance.

Cheers!
 

Dave O

Well-Known Member
Licensed User
Longtime User
Just tried v1.51, and the Enabled property is now behaving well.

However, there is no longer a horizontal line drawn under the field's value (regardless of enabled or disabled).

Perhaps related to that, the default background color shown in the designer is white (not "Default color") as opposed to the normal EditText (which doesn't expose color, but seems to default to transparent). I can change this manually to no color. Doesn't affect the continuing absence of the horizontal line.

Hope this helps!
 

Informatix

Expert
Licensed User
Longtime User
I'm going to remove the support of the background property when set in the designer. I have no other choice because there's a background set by default by the designer (what a strange idea!) and I have no control on it.
 

Informatix

Expert
Licensed User
Longtime User
Fixed. Sorry for the inconvenience.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…