How to make password GET viewable on demand?

How to make password GET viewable on demand?

Postby hua » Mon May 13, 2024 4:24 am

Is it possible to make a password GET field viewable if user click to view password?
Something similar to what we see in most web forms

TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: How to make password GET viewable on demand?

Postby nageswaragunupudi » Mon May 13, 2024 4:49 am

Code: Select all  Expand view
oGet:lShowPassword := .T. / .F.
to display or hide password
Code: Select all  Expand view
oGet:lShowPassword := !oGet:lShowPassword
to toggle display of password

Here is a sample
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oDlg, oGet
   local cPw   := Space( 20 )

   DEFINE DIALOG oDlg SIZE 300,200 PIXEL TRUEPIXEL
   @ 40,40 GET oGet VAR cPw SIZE 150,25 PIXEL OF oDlg PASSWORD ;
      ACTION ( oGet:lShowPassWord := !oGet:lShowPassword ) ;
      BITMAP "..\bitmaps\fivetech3.bmp"

   @ 90,40 BUTTON "OK" SIZE 100,40 PIXEL OF oDlg ACTION oDlg:End()
   ACTIVATE DIALOG oDlg CENTERED
   ? cPw

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to make password GET viewable on demand?

Postby hua » Mon May 13, 2024 8:41 am

Thank you very much Rao!
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: How to make password GET viewable on demand?

Postby richard-service » Tue May 14, 2024 7:28 am

nageswaragunupudi wrote:
Code: Select all  Expand view
oGet:lShowPassword := .T. / .F.
to display or hide password
Code: Select all  Expand view
oGet:lShowPassword := !oGet:lShowPassword
to toggle display of password

Here is a sample
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oDlg, oGet
   local cPw   := Space( 20 )

   DEFINE DIALOG oDlg SIZE 300,200 PIXEL TRUEPIXEL
   @ 40,40 GET oGet VAR cPw SIZE 150,25 PIXEL OF oDlg PASSWORD ;
      ACTION ( oGet:lShowPassWord := !oGet:lShowPassword ) ;
      BITMAP "..\bitmaps\fivetech3.bmp"

   @ 90,40 BUTTON "OK" SIZE 100,40 PIXEL OF oDlg ACTION oDlg:End()
   ACTIVATE DIALOG oDlg CENTERED
   ? cPw

return nil
 


Dear Rao,

How about support Resource Get?
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: How to make password GET viewable on demand?

Postby nageswaragunupudi » Tue May 14, 2024 12:28 pm

How about support Resource Get?


I guess you must be using the style ES_PASSWORD in the resource.
Above toggle should work with resource also.
Please try and provide your feedback.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to make password GET viewable on demand?

Postby karinha » Tue May 14, 2024 1:15 pm

Code: Select all  Expand view

DLG_SENHA_PASSWORD DIALOG 239, 157, 238, 148
STYLE DS_ABSALIGN | DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "Password"
FONT 8, "MS Sans Serif"
{
 EDITTEXT 20, 90, 60, 50, 14, ES_CENTER | ES_MULTILINE | ES_PASSWORD | WS_BORDER | WS_GROUP | WS_TABSTOP
 PUSHBUTTON "&Confirme", 301, 57, 93, 70, 14
 PUSHBUTTON "&Saida", 302, 129, 93, 50, 14
 GROUPBOX "Password", 501, 58, 41, 122, 50, BS_GROUPBOX
}
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: How to make password GET viewable on demand?

Postby cmsoft » Tue May 14, 2024 2:55 pm

Desde recurso, así también funciona sin indicar que es ES_PASSWORD

Code: Select all  Expand view

DEFINE DIALOG oDlg1 RESOURCE "CHANGEPASS" OF oWnd1
   oDlg1:lhelpIcon := .f.
   REDEFINE GET oGet[1] VAR cNombre   OF oDlg1 ID 109
   REDEFINE GET oGet[2] VAR cUser        OF oDlg1 ID 110
   REDEFINE GET oGet[3] VAR cPass1       OF oDlg1 ID 111
   REDEFINE GET oGet[4] VAR cPass2       OF oDlg1 ID 112
   oGet[3]:lPassword := .t.
   oGet[4]:lPassword := .t.
   REDEFINE BTNBMP oBtn RESOURCE "EYE"  OF oDlg1 ID 304 ACTION(ViewPass(oGet[3],oGet[4]))
   REDEFINE BUTTON oBot1 ID 102 OF oDlg1 ACTION ((mrta := .t.), oDlg1:End() )
   REDEFINE BUTTON oBot2 ID 103 OF oDlg1 ACTION ((mrta := .f.), oDlg1:End() ) CANCEL
ACTIVATE DIALOG oDlg1 CENTER
...

//Show/Hide Password
STATIC FUNCTION ViewPass(oGet3,oGet4)
oGet3:lPassword := !oGet3:lPassword
oGet4:lPassword := !oGet4:lPassword
oGet3:Refresh()
oGet4:Refresh()
RETURN nil
 
User avatar
cmsoft
 
Posts: 1290
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: How to make password GET viewable on demand?

Postby richard-service » Wed May 15, 2024 1:35 am

nageswaragunupudi wrote:
How about support Resource Get?


I guess you must be using the style ES_PASSWORD in the resource.
Above toggle should work with resource also.
Please try and provide your feedback.


Dear Mr.Rao
Yes, You're right. I using the style ES_PASSWORD in the resource.
I add your code and working fine.
Code: Select all  Expand view

REDEFINE GET oPassWD VAR cPass ID 102 OF oDlg UPDATE CUEBANNER "使用者密碼" ;
      ACTION ( oPassWD:lShowPassWord := !oPassWD:lShowPassword )
 
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: How to make password GET viewable on demand?

Postby richard-service » Wed May 15, 2024 1:37 am

cmsoft wrote:Desde recurso, así también funciona sin indicar que es ES_PASSWORD

Code: Select all  Expand view

DEFINE DIALOG oDlg1 RESOURCE "CHANGEPASS" OF oWnd1
   oDlg1:lhelpIcon := .f.
   REDEFINE GET oGet[1] VAR cNombre   OF oDlg1 ID 109
   REDEFINE GET oGet[2] VAR cUser        OF oDlg1 ID 110
   REDEFINE GET oGet[3] VAR cPass1       OF oDlg1 ID 111
   REDEFINE GET oGet[4] VAR cPass2       OF oDlg1 ID 112
   oGet[3]:lPassword := .t.
   oGet[4]:lPassword := .t.
   REDEFINE BTNBMP oBtn RESOURCE "EYE"  OF oDlg1 ID 304 ACTION(ViewPass(oGet[3],oGet[4]))
   REDEFINE BUTTON oBot1 ID 102 OF oDlg1 ACTION ((mrta := .t.), oDlg1:End() )
   REDEFINE BUTTON oBot2 ID 103 OF oDlg1 ACTION ((mrta := .f.), oDlg1:End() ) CANCEL
ACTIVATE DIALOG oDlg1 CENTER
...

//Show/Hide Password
STATIC FUNCTION ViewPass(oGet3,oGet4)
oGet3:lPassword := !oGet3:lPassword
oGet4:lPassword := !oGet4:lPassword
oGet3:Refresh()
oGet4:Refresh()
RETURN nil
 


Dear Cesar Gomez
Your sample code working fine. Thank you.
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Natter and 56 guests