HOW to unseen Password when user is typing

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: HOW to unseen Password when user is typing

Post by Simon » Sun Aug 25, 2013 4:02 pm

Ok, this is going to be harder than I thought.
I am not giving you code, I am leading you to solve a problem.
When I give you code it will look like this:

Code: Select all

this you can copy and paste
Again, using the variable watcher and the code from the dictionary what do you see in "theKey"?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

ECNU4271
Posts: 93
Joined: Tue May 07, 2013 4:33 pm

Re: HOW to unseen Password when user is typing

Post by ECNU4271 » Sun Aug 25, 2013 4:43 pm

Simon wrote:Ok, this is going to be harder than I thought.
I am not giving you code, I am leading you to solve a problem.
When I give you code it will look like this:

Code: Select all

this you can copy and paste
Again, using the variable watcher and the code from the dictionary what do you see in "theKey"?

Simon
Sorry I was just keeping waiting for your reply and didn't realize there is a page 2.
The examples in the dictionary,
Examples on keyDown theKey
I dont really understand what does it mean. Besides, could you please show an simple example of how to do a correct keyDown command?

Michael

andrewferguson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 184
Joined: Wed Apr 10, 2013 5:09 pm

Re: HOW to unseen Password when user is typing

Post by andrewferguson » Sun Aug 25, 2013 5:12 pm

Hi Michael,
Try putting this script into your password field:

Code: Select all

global thePassword
on textChanged
   lock screen
   if the text of me = empty then
      put empty into thePassword
      exit textChanged
   end if
   if the last char of me <> "*" then
      put the last char of me after thePassword
      delete the last char of me
      put "*" after me
   else
      delete the last char of thePassword
   end if
   unlock screen
end textChanged
You should now have the users password stored in the global variable thePassword.
Andrew

ECNU4271
Posts: 93
Joined: Tue May 07, 2013 4:33 pm

Re: HOW to unseen Password when user is typing

Post by ECNU4271 » Sun Aug 25, 2013 5:22 pm

andrewferguson wrote:Hi Michael,
Try putting this script into your password field:

Code: Select all

global thePassword
on textChanged
   lock screen
   if the text of me = empty then
      put empty into thePassword
      exit textChanged
   end if
   if the last char of me <> "*" then
      put the last char of me after thePassword
      delete the last char of me
      put "*" after me
   else
      delete the last char of thePassword
   end if
   unlock screen
end textChanged
You should now have the users password stored in the global variable thePassword.
Andrew
Thanks Andrew, it works very well. Although I don't understand the process. That should hold me for a while on this issue . :D

ECNU4271
Posts: 93
Joined: Tue May 07, 2013 4:33 pm

Re: HOW to unseen Password when user is typing

Post by ECNU4271 » Sun Aug 25, 2013 5:28 pm

Althougt I still don't know how to solve the "keyboard covering fields while typing" issue.....

andrewferguson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 184
Joined: Wed Apr 10, 2013 5:09 pm

Re: HOW to unseen Password when user is typing

Post by andrewferguson » Sun Aug 25, 2013 6:23 pm

Hi Michael,
Here is an updated version of the code, which now includes comments. Hopefully this will help you work it out.

Code: Select all

global thePassword --declare a variable called thePassword and make it global
on textChanged --when the text is the field has changed (the user has entered more text
   lock screen --stop updating the screen so the user does not see any changes
   if the text of me = empty then --if the password field has nop text in it
      put empty into thePassword --put empty into thePassword variable
      exit textChanged --stop this handler
   end if
   if the last char of me <> "*" then --if the last letter of the password field has not already been converted
      put the last char of me after thePassword --add the last character to the variable thePassword
      delete the last char of me --delete the actual letter in the password field and...
      put "*" after me --...put a * in its place
   else
      delete the last char of thePassword --the user has pressed the backspace key, so delete the last letter from thePassword variable as well
   end if
   unlock screen --unlock the screen so the user can see changes
end textChanged
As for the problem where iPhone keyboard hides the field, I'm afraid I cannot help you as I have never written an iPhone app.
If you don't get a response on this thread any time soon, why not posting that specific question on the iOS Deployment forum?
Andrew

Post Reply