Paste values into Password Protected Get Objects

Post Reply
User avatar
don lowenstein
Posts: 196
Joined: Mon Oct 17, 2005 9:09 pm
Contact:

Paste values into Password Protected Get Objects

Post 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.
Don Lowenstein
www.laapc.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Paste values into Password Protected Get Objects

Post 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
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
don lowenstein
Posts: 196
Joined: Mon Oct 17, 2005 9:09 pm
Contact:

Re: Paste values into Password Protected Get Objects

Post 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?
Don Lowenstein
www.laapc.com
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Paste values into Password Protected Get Objects

Post 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.
João Santos - São Paulo - Brasil
User avatar
don lowenstein
Posts: 196
Joined: Mon Oct 17, 2005 9:09 pm
Contact:

Re: Paste values into Password Protected Get Objects

Post 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 )
Don Lowenstein
www.laapc.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Paste values into Password Protected Get Objects

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
don lowenstein
Posts: 196
Joined: Mon Oct 17, 2005 9:09 pm
Contact:

Re: Paste values into Password Protected Get Objects

Post by don lowenstein »

Yeah,

That's why we re-wrote it as shown above.

hopefully all is solved.

Respectfully,
Don.
Don Lowenstein
www.laapc.com
Post Reply