FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Paste values into Password Protected Get Objects
Posts: 204
Joined: Mon Oct 17, 2005 09:09 PM

Paste values into Password Protected Get Objects

Posted: Fri Oct 11, 2019 09: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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Paste values into Password Protected Get Objects

Posted: Sun Oct 13, 2019 03: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 (fw): Select all Collapse
   @ 130,150 GET cPw   SIZE 200,28 PIXEL OF oDlg PASSWORD


Please use
Code (fw): Select all Collapse
   @ 130,150 EDIT cPw   SIZE 200,28 PIXEL OF oDlg PASSWORD
Regards



G. N. Rao.

Hyderabad, India
Posts: 204
Joined: Mon Oct 17, 2005 09:09 PM

Re: Paste values into Password Protected Get Objects

Posted: Tue Oct 15, 2019 06: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
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM

Re: Paste values into Password Protected Get Objects

Posted: Tue Oct 15, 2019 07:13 PM
In TGET.PRG

Code (fw): Select all Collapse
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( ::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
Posts: 204
Joined: Mon Oct 17, 2005 09:09 PM

Re: Paste values into Password Protected Get Objects

Posted: Tue Oct 15, 2019 08: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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Paste values into Password Protected Get Objects

Posted: 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
Posts: 204
Joined: Mon Oct 17, 2005 09:09 PM

Re: Paste values into Password Protected Get Objects

Posted: Mon Nov 25, 2019 05:45 PM

Yeah,

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

hopefully all is solved.

Respectfully,
Don.

Don Lowenstein
www.laapc.com

Continue the discussion