Einzelnen Beitrag anzeigen
Alt 13.10.2012, 11:33   #170
leecher
Moderator
PASSW

E r g e b n i s / R e s u l t

Reads a Password at the specified position of the screen.

B e s c h r e i b u n g / D e s c r i p t i o n

This function reads a password of length pwdlen from the keyboard at the specified position xpos, ypos on the screen and hides the typed characters with the given hidechar.
Maximum length of password is 15 characters.

S y n t a x

Code:
pwd = call('passw',xpos,ypos,hidechar,pwdlen)
P a r a m e t e r

xpos - The x position on the screen where to read the characters
ypos - The y position on the screen where to read the characters
hidechar - The character used for hide the typed characters
pwdlen - The length of the password

R e t u r n s

A string with containing the character.
The string ~~~ is returned if K_UNDO (ESC) is pressed
The string ??? is returned if K_HELP (F1) is pressed

B e i s p i e l / E x a m p l e

Code:
pwd = ''
xpos = 21 
ypos = 12 
hidechar = '-'
pwdlen = 5       ! specify length of password 

put at 5,12 'Enter Password: ' 
pwd = call('passw',xpos,ypos,hidechar,pwdlen)
!pwd = (*STR) call('passw',xpos,ypos,hidechar,pwdlen)   ! for compiler
if  length(pwd) > 0
    if  pwd = '???'
        put at 5,14 'HELP KEY was pressed'
    else if pwd = '~~~'    
        put at 5,14 'ESC KEY was pressed'
    else    
        put at 5,14 'The password is : ', pwd
    end if    
    p = true
    get p 
end if 
detach "keybuff"
leecher ist offline   Mit Zitat antworten