Page 1 of 1
Paste values into Password Protected Get Objects
Posted: Fri Oct 11, 2019 9:52 pm
by don lowenstein
I have used fwh 1302 for many years until recently, when I upgraded to fwh 1905.
I found a difference when specifying lPassword := .t. on a tget() object.
If I paste a value into the "masked" get-object created with the 1302 version, no problem. The get displays all asterisks, but contains the proper value.
If I paste a value into the "masked" get-object created with the 1905 version, I have a problem.
The get object displays all asterisks, and erroneously stores the "mask" of all asterisks in the object as it's data value.
Has anyone else experienced this?
Thanks in advance.
Re: Paste values into Password Protected Get Objects
Posted: Sun Oct 13, 2019 3:45 pm
by nageswaragunupudi
We regret the bug. Thanks for pointing out.
For the time being, we request you to adopt this work around:
Instead of
Code: Select all
@ 130,150 GET cPw SIZE 200,28 PIXEL OF oDlg PASSWORD
Please use
Code: Select all
@ 130,150 EDIT cPw SIZE 200,28 PIXEL OF oDlg PASSWORD
Re: Paste values into Password Protected Get Objects
Posted: Tue Oct 15, 2019 6:05 pm
by don lowenstein
I've created an subordinate extension from the TGet class that I use.
All of my screens are dynamically generated and this one exception might be dangerous.
Is there a method I can "pirate" from the EDIT control to compile in my sub-ordinate TGet class that will resolve this for now?
Re: Paste values into Password Protected Get Objects
Posted: Tue Oct 15, 2019 7:13 pm
by karinha
In TGET.PRG
Code: Select all
METHOD DispText() CLASS TGet
if ::lPassword .and. ::oGet:Type == "C"
#ifdef UTFREVN
if ::lWideChar
::SetText( ::GetText() )
else
SetWindowText( ::hWnd, Replicate( If( IsAppThemed(), Chr( 149 ), "*" ),;
Len( Trim( ::oGet:buffer ) ) ) )
endif
#else
/* //-> Change/Cambiar
SetWindowText( ::hWnd, Replicate( If( IsAppThemed(), Chr( 149 ), "*" ),;
Len( Trim( ::oGet:buffer ) ) ) )
*/
SetWindowText( ::hWnd, Replicate( If( IsAppThemed(), Chr( 42 ), "*" ),;
Len( Trim( ::oGet:buffer ) ) ) )
#endif
else
#ifdef UTFREVN2
if ::lLimitChars
// ::SetText( Trim( ::GetText() ) )
::SetText( Trim( ::oGet:buffer ) ) // fix 2016-07-07
else
SetWindowText( ::hWnd, If( ! Empty( ::cCueText );
.and. Empty( ::oGet:VarGet() );
.and. GetFocus() != ::hWnd,; // Focus is outside
"", ::oGet:buffer ) )
endif
#else
SetWindowText( ::hWnd, If( ! Empty( ::cCueText );
.and. Empty( ::oGet:VarGet() );
.and. GetFocus() != ::hWnd,; // Focus is outside
"", ::oGet:buffer ) )
#endif
endif
return nil
Regards, saludos.
Re: Paste values into Password Protected Get Objects
Posted: Tue Oct 15, 2019 8:14 pm
by don lowenstein
The posted sample did not work for me.
However, the class below takes care of the problem for me.
********************************************************************************************************************
//** REFRESH PASSWORD ON PASTE - WITHOUT REFRESH PASSWORD IS SHOWN IF PASTED
CLASS TPGet FROM TGET
DATA CTRL_V AS CHARACTER
METHOD KeyChar( nKey, nFlags )
METHOD HandleEvent( nMsg, nWParam, nLParam )
ENDCLASS
*********************
METHOD KeyChar( nKey, nFlags ) CLASS TPGet
SELF:CTRL_V := 'N'
IF NKEY = K_CTRL_V //** NKEY=22 Ctrl-V PASTE
SELF:CTRL_V := 'Y'
ENDIF
return ::Super:KeyChar( nKey, nFlags )
***********************************************************************************************
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TPGet //** P3N - 06/19/14
local oClp, cText, n
DEFAULT SELF:CTRL_V := ' '
do case
case nMsg == WM_PASTE
if GetFocus() == ::hWnd
CallWindowProc( ::nOldProc, ::hWnd, WM_PASTE, 0, 0 )
if ValType( ::oGet:Original ) $ "CM"
SetWindowText( ::hWnd, SubStr( GetWindowText( ::hWnd ), 1, Len( ::oGet:Original ) ) )
endif
::oGet:Buffer = GetWindowText( ::hWnd )
::oGet:Pos = GetCaretPos()[ 2 ]
::oGet:Assign()
if ::bChange != nil
Eval( ::bChange,,, Self )
endif
endif
IF SELF:LPASSWORD
IF SELF:CTRL_V$'Y'
//** DO NOT REFRESH IF CTRL_V PASTE - CONTINUE
ELSE
SELF:REFRESH() //** Right mouse button click - Paste opt selected
ENDIF
ENDIF
return 0
endcase
return ::Super:HandleEvent( nMsg, nWParam, nLParam )
Re: Paste values into Password Protected Get Objects
Posted: Sun Nov 24, 2019 11:41 pm
by nageswaragunupudi
Fixed in FWH1910.
In fact, pasting text into password gets had issues even in older versions, including FWH1302.
FWH1910 should solve all the issues.
Re: Paste values into Password Protected Get Objects
Posted: Mon Nov 25, 2019 5:45 pm
by don lowenstein
Yeah,
That's why we re-wrote it as shown above.
hopefully all is solved.
Respectfully,
Don.