Paste values into Password Protected Get Objects

Paste values into Password Protected Get Objects

Postby don lowenstein » Fri Oct 11, 2019 9:52 pm

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
don lowenstein
 
Posts: 197
Joined: Mon Oct 17, 2005 9:09 pm

Re: Paste values into Password Protected Get Objects

Postby nageswaragunupudi » Sun Oct 13, 2019 3:45 pm

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  Expand view
  @ 130,150 GET cPw   SIZE 200,28 PIXEL OF oDlg PASSWORD
 


Please use
Code: Select all  Expand view
  @ 130,150 EDIT cPw   SIZE 200,28 PIXEL OF oDlg PASSWORD
 
Regards

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

Re: Paste values into Password Protected Get Objects

Postby don lowenstein » Tue Oct 15, 2019 6:05 pm

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
don lowenstein
 
Posts: 197
Joined: Mon Oct 17, 2005 9:09 pm

Re: Paste values into Password Protected Get Objects

Postby karinha » Tue Oct 15, 2019 7:13 pm

In TGET.PRG

Code: Select all  Expand view

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 - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7825
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Paste values into Password Protected Get Objects

Postby 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 )
Don Lowenstein
www.laapc.com
User avatar
don lowenstein
 
Posts: 197
Joined: Mon Oct 17, 2005 9:09 pm

Re: Paste values into Password Protected Get Objects

Postby nageswaragunupudi » Sun Nov 24, 2019 11:41 pm

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
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Paste values into Password Protected Get Objects

Postby don lowenstein » Mon Nov 25, 2019 5:45 pm

Yeah,

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

hopefully all is solved.

Respectfully,
Don.
Don Lowenstein
www.laapc.com
User avatar
don lowenstein
 
Posts: 197
Joined: Mon Oct 17, 2005 9:09 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 49 guests