FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Get Cut/Paste problem
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Get Cut/Paste problem

Posted: Thu Aug 10, 2006 08:36 PM
James,

> The Cut routine also needs a similar fix. This seems to be working:

Thanks,

> Now Ctrl-X and Ctrl-V need fixing

In Method KeyDown() please remove these 3 lines:
      case ( nKey == VK_INSERT .and. GetKeyState( VK_SHIFT ) ) .or. ;
           ( nKey == ASC("V") .and. GetKeyState( VK_CONTROL ) ) .or. ;
           ( nKey == ASC('X') .and. GetKeyState( VK_CONTROL ) ) .and. ; 
           ! lAnd( nFlags, 2 ** 29 )

          if ! ::lReadOnly
             CallWindowProc( ::nOldProc, ::hWnd, WM_KEYDOWN, nKey, nFlags )
             SysRefresh()
             if ValType( ::oGet:buffer ) = "C"
                ::oGet:buffer = Pad( GetWindowText( ::hWnd ), Len( ::oGet:buffer ) )
                SetWindowText( ::hWnd, ::oGet:buffer )
             else
                ::oGet:buffer = GetWindowText( ::hWnd )
             endif
             ::oGet:Assign()
             // ::GetSelPos( @nLo, @nHi )      THIS
             // ::nPos = nHi + 1                    THIS
             // ::oGet:Pos = ::nPos               THIS 
             if ::bChange != nil
                Eval( ::bChange, nKey, nFlags, Self )
             endif
          endif

          return 0


Now it seems to work fine. We appreciate your feedback, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Get Cut/Paste problem

Posted: Thu Aug 10, 2006 09:44 PM
Antonio,

I had to make some additions to get it working. There are two new sections of code. Also I had to add a new LOCAL oClp at the top of the method.

James

     case ( nKey == VK_INSERT .and. GetKeyState( VK_SHIFT ) ) .or. ;
           ( nKey == ASC("V") .and. GetKeyState( VK_CONTROL ) ) .or. ;
           ( nKey == ASC('X') .and. GetKeyState( VK_CONTROL ) )

          if ! ::lReadOnly

           // new section
           DEFINE CLIPBOARD oClp OF Self FORMAT TEXT
           nPos := Len( oClp:GetText() )
           oClp:End()
           // end of new section

             CallWindowProc( ::nOldProc, ::hWnd, WM_KEYDOWN, nKey, nFlags )
             SysRefresh()
             if ValType( ::oGet:buffer ) = "C"
                ::oGet:buffer = Pad( GetWindowText( ::hWnd ), Len( ::oGet:buffer ) )
                SetWindowText( ::hWnd, ::oGet:buffer )
             else
                ::oGet:buffer = GetWindowText( ::hWnd )
             endif
             ::oGet:Assign()
             //::GetSelPos( @nLo, @nHi )
             //::nPos = nHi + 1
             //::oGet:Pos = ::nPos

             // New section
             do case
                case nKey == ASC('X')
                   ::setPos( nPos )
                case nKey == ASC('V')
                   ::setPos( ::oGet:pos )
             endcase
             // end of new section

             if ::bChange != nil
                Eval( ::bChange, nKey, nFlags, Self )
             endif
          endif

          return 0
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 223
Joined: Thu Dec 01, 2005 03:34 PM

Get Cut/Paste problem

Posted: Thu Aug 10, 2006 10:36 PM

Antonio & James,

Antonio's fix with James' modification to WM_CUT works like a charm!

However, anyone inserting this code into their version of TGet.prg will need to insert the following defines at the top of the file:

define WM_CUT 768 // 0x300

define WM_PASTE 770 // 0x302

Also, be sure to declare the HandleEvent() method in the list of the TGet class's methods up near the top of the prg where the class is defined....
...
METHOD HandleEvent()
...

Whoops - I see that James has been doing more work while I was typing this in. I'll have to try out his added mods now.

  • Roger
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Get Cut/Paste problem

Posted: Thu Aug 10, 2006 10:42 PM

Roger,

Thanks for pointing out those missing items.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 284
Joined: Mon Oct 24, 2005 08:04 PM

Get Cut/Paste problem

Posted: Fri Aug 11, 2006 05:56 PM

Antonio, James, Roger,

Thanks a lot for fixing this!

Best Regards,
Randal Ferguson

Continue the discussion