by don lowenstein » Tue Oct 15, 2019 8:14 pm
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 )