I am currently working on an application to organise my programming functions for various languages and wanted to share some example code for anyone who wants to know how to program a password entry box using "*" to mask the characters in BLUEGUI.
I created 2 edit boxes, a visible password edit box and a hidden edit box to store the actual keys that were pressed. The visible box displays the "*" characters as a mask.
An array was used to store the key presses:
global dim keylist(0) as string
The code below is with a do...loop block along with the getevent command.
if eventType()=KEYDOWN `has a key been pressed
if eventsource()=editPwd `focus is on password edit box?
`ignore special key codes e.g. tab, enter, shift etc
if eventdata() > 0x1F
`insert key char into dummy edit box (hidden)
setgadgetText editPwddummy,getgadgettext(editPwd)
`if valid key was pressed add an element into global array
array insert at bottom keylist(0)
`add the key that was pressed into an array element
keylist() = getgadgettext(editPwddummy)
`clear the dummy edit box ready for next key entry
setgadgettext editPwddummy,""
`set a string var with the "*" to be used for masking letters being pressed
k$=k$+"*"
`insert "*" into the password edit box
setgadgetText editPwd, k$
endif
endif
endif
Then when the user presses the 'Login' button, I used the following code to validate the string in the global array keylist().
for i = 0 to array count (keylist(0))
temp$=temp$+keylist(i)
next i
for i = 1 to len(temp$)
if mid$(temp$,i)<>"*"
temp2$=temp2$+mid$(temp$,i)
endif
next i
pwd = temp2$
temp$="":temp2$=""
[EDIT] - after all that and searching the forums again, I found the SetPassWordOnly <gadget handle>, bool command with an updated version of BlueGUI. Oh well, I learnt something.