Password eye-like icon for PW preview

Harbour, MingW related news.

Moderator: Rathinagiri

Post Reply
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Password eye-like icon for PW preview

Post by bluebird »

Is there any way to implement the feature in many web sites that let you click on an icon at right of the password
to show what you have typed so far without actually entering the password. On may log-ins it looks like an eyeball icon.

Thanks
Georg_BA
Posts: 106
Joined: Fri Apr 07, 2017 5:31 pm
DBs Used: DBF

Re: Password eye-like icon for PW preview

Post by Georg_BA »

Hello everyone

I will use this. I hope it helps possibly serve as an inspiration.

......

DEFINE LABEL LBL_pswd
ROW 150
COL 190
WIDTH 180
VALUE Msg_004
FONTNAME "verdana"
FONTSIZE 9
FONTCOLOR BLACK
FONTBOLD .T.
END LABEL

DEFINE TEXTBOX Txt_Pswd
ROW 170
COL 190
WIDTH 180
PASSWORD .T.
BACKCOLOR WHITE
ONGOTFOCUS frm_Login.Txt_Pswd.BACKCOLOR:={255, 255, 128}
ONLOSTFOCUS frm_Login.Txt_Pswd.BACKCOLOR:={255,255,255}
MAXLENGTH 10
ONENTER Confirm_Login()
END TEXTBOX

DEFINE IMAGE IMG_spsw
ROW 170
COL 190+180+20
WIDTH 24
HEIGHT 24
ONCLICK ukaz_psw(.t.)
PICTURE "okoo"
TOOLTIP 'Show'
END IMAGE

DEFINE IMAGE IMG_hpsw
ROW 170
COL 190+180+20
WIDTH 24
HEIGHT 24
ONCLICK ukaz_psw(.f.)
PICTURE "okoz"
TOOLTIP 'Hide'
END IMAGE


DEFINE BUTTON BT_OK
ROW 220
COL 170
CAPTION "Ok"
PICTURE "KEYS02"
FLAT .T.
WIDTH 90+30
HEIGHT 40
FONTNAME "verdana"
FONTSIZE 9
FONTBOLD .T.
TABSTOP .T.
VISIBLE .T.
TRANSPARENT .T.
BACKCOLOR NIL
TOOLTIP Msg_005
ACTION Confirm_Login()
MULTILINE .F.
PICTALIGNMENT LEFT
END BUTTON

DEFINE BUTTON BT_ZRUS
ROW 220
COL 270+35
CAPTION Msg_006
PICTURE "logout"
FLAT .T.
WIDTH 120
HEIGHT 40
FONTNAME "verdana"
FONTSIZE 9
FONTBOLD .T.
TABSTOP .T.
VISIBLE .T.
TRANSPARENT .T.
BACKCOLOR NIL
TOOLTIP Msg_007
ACTION Cancel_Login()
MULTILINE .F.
PICTALIGNMENT LEFT
END BUTTON


END WINDOW
frm_Login.IMG_hpsw.hide

if login_pri > 1 //prisnost prihlasenia
frm_Login.Txt_Login.SetFocus
else
frm_Login.Txt_pswd.SetFocus
endif
CENTER WINDOW frm_Login
ACTIVATE WINDOW frm_Login

RETURN NIL

......

function ukaz_psw(ako)
LOCAL lShowPass := ako
if ako=.t.
frm_Login.IMG_hpsw.show
frm_Login.IMG_spsw.hide
//frm_Login.Txt_Pswd.REDRAW
//SendMessage(frm_Login.Txt_Pswd.HANDLE, 0x00CC /*EM_SETPASSWORDCHAR*/, If(lShowPass, 0, 0x25CF), 0)
//RedrawWindow(frm_Login.Txt_Pswd.HANDLE)

else
frm_Login.IMG_hpsw.hide
frm_Login.IMG_spsw.show

endif
SendMessage(frm_Login.Txt_Pswd.HANDLE, 0x00CC /*EM_SETPASSWORDCHAR*/, If(lShowPass, 0, 0x25CF), 0)
RedrawWindow(frm_Login.Txt_Pswd.HANDLE)
return
Attachments
show_24.png
show_24.png (490 Bytes) Viewed 7592 times
private_red24.png
private_red24.png (1.02 KiB) Viewed 7592 times
Screenshot_2.jpg
Screenshot_2.jpg (12.55 KiB) Viewed 7592 times
Screenshot_1.jpg
Screenshot_1.jpg (13.77 KiB) Viewed 7592 times
User avatar
fouednoomen
Posts: 186
Joined: Sun Oct 14, 2012 8:33 am
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL, Oracle, ODBC
Location: Tunisia

Re: Password eye-like icon for PW preview

Post by fouednoomen »

Many thanks for sharing
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Password eye-like icon for PW preview

Post by franco »

I think this is what you mean

local view
window win_emp
define textbox text_12
password
define button
ACTION {|| {view:=win_emp.Text_12.value} ,{msgbox(view) }}

With this you have not hit enter to create a count of wrong password.
Franco
All The Best,
Franco
Canada
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: Password eye-like icon for PW preview

Post by bluebird »

fouednoomen wrote: Sun Aug 09, 2020 7:40 pm Please explain where you got lines:
SendMessage(frm_Login.Txt_Pswd.HANDLE, 0x00CC /*EM_SETPASSWORDCHAR*/, If(lShowPass, 0, 0x25CF), 0)
RedrawWindow(frm_Login.Txt_Pswd.HANDLE)

Thank You
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Password eye-like icon for PW preview

Post by mustafa »

Hello friends

3 Samples

Sample_1.prg
Sample_2.prg
Sample_3.prg

Username = "admin"
Password = "admin"

Regards
Mustafa
Attachments
Password_Eye.zip
(61.87 KiB) Downloaded 272 times
Post Reply