How to add password constraint into manually added textfield ?

297 views
Skip to first unread message

test

unread,
Jan 20, 2014, 6:03:44 AM1/20/14
to codenameone...@googlegroups.com
Hi Shai,

I have put password field in manual coding as below.

            TextField passwordTxtField = new TextField();
            passwordTxtField.setFocusable(true);
            passwordTxtField.setRows(2);
            passwordTxtField.setHint("Password");

Now how to add password constraint to passwordTxtField ?

Thanks.

This message and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any unauthorised dissemination or copying of this e-mail, and any use or disclosure of any attachments contained in it, is strictly prohibited and may be illegal. If you have received the e-mail in error please notify us on in...@imriel.com or telephone +44 20 8123 0630. Any views expressed by an individual within this e-mail do not necessarily reflect the views of the firm.
IMRIEL LIMITED; Company number 5927583, registered office 81 Oxford Street, London W1D 2EU

Chen Fishbein

unread,
Jan 20, 2014, 8:21:08 AM1/20/14
to codenameone...@googlegroups.com, ru...@imriel.com
Hi,
Use passwordTxtField.setConstraint(TextField.PASSWORD);

Shai Almog

unread,
Jan 20, 2014, 12:56:49 PM1/20/14
to codenameone...@googlegroups.com, ru...@imriel.com
Also don't set 2 rows, it won't work on some devices with constraints (e.g. iOS).

test

unread,
Jan 21, 2014, 1:23:12 AM1/21/14
to codenameone...@googlegroups.com

Hi Shai,

I have set 2 rows for setting height of textfield. owise textfield looks very small in ipad device.for user it's not comfort to add input. if any other way to set height will be most appreciate.

other thing is for password "passwordTxtField.setConstraint(TextField.PASSWORD)" code set password when lost focus from password field.
I need to enter password like enter password character and suddenly it has to converts into * or else hidden character. as user can see what he has entered in password field.

also one more thing is when i checked remember me user login credential on ios/android device then login form has to be come with prefilled username and password. in this case password comes in actual text instead of hidden text.code as below.

if(Storage.getInstance().readObject("username")!=null){
                loginTxtField.setText(Storage.getInstance().readObject("username").toString());
            }
if(Storage.getInstance().readObject("password")!=null){
                passwordTxtField.setText(Storage.getInstance().readObject("password").toString());
            }

Any suggestion ?

Thanks.



On Monday, January 20, 2014 11:26:49 PM UTC+5:30, Shai Almog wrote:
Also don't set 2 rows, it won't work on some devices with constraints (e.g. iOS).

Shai Almog

unread,
Jan 21, 2014, 1:57:57 AM1/21/14
to codenameone...@googlegroups.com, ru...@imriel.com
Hi,
you can use millimeter padding to increase height.
If using the native theme you can wrap it in a ComponentGroup which will also enlarge it.

I'm guessing the constraint isn't set for this case on your side.
Reply all
Reply to author
Forward
0 new messages