Page 1 of 1

Password Field

Posted: Mon Jul 05, 2010 6:38 pm
by SirWobbyTheFirst
Hello again.

I am sorting out my logon system and would just like to know how to use the ImageSource property to change the character inputted into the field to a bullet, I tried a stack before which trapped the RawKeyDown and KeyDown messages and places the character into a separate property but doesn't quite work if I paste a value into the field.

So if someone could give me a hand, I would really appreciate it, I found something which did it before but the hard drive packed in afterward and the favourite link vanished.

Thanks, Michael.

Re: Password Field

Posted: Tue Jul 06, 2010 7:50 am
by Curry
By all means use the imageSource for a fancier bullet if desired (either put a character after the field text and then set the imagesource of the last char to your image, or use htmlText) but it's also possible to use a text bullet character, and many password fields out there in the software and web word simply use asterisks, so that might make your job a lot easier.

Re: Password Field

Posted: Wed Jul 07, 2010 4:00 pm
by Mark
Hi Michael,

You will find a complete password widget here. Just scroll down a little bit.

Best regards,

Mark

Re: Password Field

Posted: Wed Jul 07, 2010 8:05 pm
by SirWobbyTheFirst
Ah thank you Mark. :)

Re: Password Field

Posted: Sat May 12, 2012 8:26 am
by fleo
Hi, I recentely got the same problem. This is how I solved it. The following script is in the password input field:

on KeyUp
repeat with x = 1 to the number of chars of me
set the imageSource of char x of me to "bullet"
end repeat
pass KeyUp
end KeyUp

on pasteKey
paste
repeat with x = 1 to the number of chars of me
set the imageSource of char x of me to "bullet"
end repeat
end pasteKey

(where "bullet" is the name of an imported image resource).

Re: Password Field

Posted: Sat May 12, 2012 9:34 am
by tzenobite
why not using numtochar(165) for the bullet char?

edit: this is how i fake the password field on the iphone ios
i use two field, one with the "bulletted" text and another that stores the clear text (fld "password")
after two seconds the last key pressed the last char in the field is "crypted" just like in the ios appears
the image "x autore" is a little white x in a gray circle, as in the text field of the iphone


on mouseup
set the locktext of fld "username" to true
set the locktext of me to false
put "" into me
select the text of me
put "" into fld "password"
end mouseup

on openfield
put "" into me
hide image "x autore"
end openfield

global idletime

on keyup
show image "x autore"
put last char of me after fld "password"
if (number of chars of me > 1) then put numtochar(165) into char ((number of chars of me)-1) of me
select after last char of me
global idletime
put the seconds into idletime
end keyup

on idle
if the locktext of me = true then exit idle
if (me) = "" then exit idle
put the seconds - idletime into pausa
if pausa = 1 then
put the seconds into idletime
put last char of me after fld "password"
put numtochar(165) into last char of me
end if
end idle

Re: Password Field

Posted: Sat May 12, 2012 11:40 am
by fleo
numchar(165) is a pretty good idea, thanks!

I tried your script. It works generally fine but I think it has some slight issues, though.
If you type fast, very fast, some chars won't be crypted (I'm running the application on a desktop environment, not on the iphone).
If you paste a string, instead of typing it char by char, it won't be crypted as well (as originally noticed by the author of the thread).

Re: Password Field

Posted: Sat May 12, 2012 11:52 am
by Mark
Hi,

It is really difficult to make a really good password field. I worked on mine for several months and it is still not perfect, but it is good enough for use in commercial products. See the link I provided earlier.

If you don't want to donate for the password field, then I think using imageSource is the best alternative, because it avoids having to deal with all kinds of possible user actions.

Kind regards,

Mark

Re: Password Field

Posted: Sat May 12, 2012 12:54 pm
by tzenobite
good point regarding the "paste" action
try this, in the idle handler

Code: Select all

if (number of chars of me > 1) then 
repeat with i=1 to ((number of chars of me)-1
put numtochar(165) into char i of me
end repeat
(i'm away from my home)

Re: Password Field

Posted: Sun May 13, 2012 3:50 pm
by tzenobite
update field
pasting text on it doesn't work
enjoy it :)

Re: Password Field

Posted: Sun May 13, 2012 9:40 pm
by jacque
iOS input fields have a built-in password option. It might be easier to use that on mobile.

On desktop, I prefer the imagesource solution. It lets you read the text directly without having to store it somewhere else, and it's relatively easy to implement.