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
oGet:lShowPassword := .T. / .F.
oGet:lShowPassword := !oGet:lShowPassword
#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
nageswaragunupudi wrote:to display or hide password
- Code: Select all Expand view
oGet:lShowPassword := .T. / .F.to toggle display of password
- Code: Select all Expand view
oGet:lShowPassword := !oGet:lShowPassword
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
How about support Resource Get?
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
}
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
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.
REDEFINE GET oPassWD VAR cPass ID 102 OF oDlg UPDATE CUEBANNER "使用者密碼" ;
ACTION ( oPassWD:lShowPassWord := !oPassWD:lShowPassword )
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
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 69 guests