Get Cut/Paste problem

Postby Antonio Linares » Thu Aug 10, 2006 8: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:
Code: Select all  Expand view
      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
User avatar
Antonio Linares
Site Admin
 
Posts: 42071
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Thu Aug 10, 2006 9: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

Code: Select all  Expand view
     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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Roger Seiler » 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
User avatar
Roger Seiler
 
Posts: 223
Joined: Thu Dec 01, 2005 3:34 pm
Location: Nyack, New York, USA

Postby James Bott » Thu Aug 10, 2006 10:42 pm

Roger,

Thanks for pointing out those missing items.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Randal » Fri Aug 11, 2006 5:56 pm

Antonio, James, Roger,

Thanks a lot for fixing this!

Best Regards,
Randal Ferguson
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 54 guests