FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Copy/Paste
Posts: 28
Joined: Mon Apr 27, 2009 03:37 PM
Copy/Paste
Posted: Wed Oct 12, 2011 02:37 PM

We have found a problem, where copy/paste does not work correctly if copying from one get to another, unless the get we are pasting to is a multiline get. We have testing this on an older version(10.06) of fivewin and works fine. When you paste it looks like only the first letter is pasted.

Any suggestions?

Regards
Gary

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Copy/Paste
Posted: Thu Oct 13, 2011 04:03 AM

Here copy paste is working fine. Tested with FWH ver 11.09

#include "FiveWin.ch"
Function Main()

    Local oDlg,oGet1,oGet2,cVar1:=Space(30),cVar2:=space(30)
    
    DEFINE DIALOG oDlg TITLE "Testing Copy Paste"
    
        @01,01 GET oGet1 VAR cVar1 SIZE 100,12
        @03,01 GET oGet2 VAR cVar2 SIZE 100,12
    
    ACTIVATE DIALOG oDlg
     
Return nil

Regards
Anser

Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Copy/Paste
Posted: Thu Oct 13, 2011 08:01 AM

Could this be a xHarbour.com & FWH 11.09 compatability issue?

Can anyone tell me the source code to check for differences between FW versions and also put debug statements in?

best regards,

Pete

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: Copy/Paste
Posted: Thu Oct 13, 2011 08:37 AM

If you are using resources make sure the field you want to paste to has ES_AUTOHSCROLL

CONTROL "", 208, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 54, 3, 70, 12 as an example

Hth

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Copy/Paste
Posted: Thu Oct 13, 2011 08:45 AM

The field I just tested it on has ES_AUTOHSCROLL - I know that not all of my fields in my app has this though.

If I compile my app with FW 10.06 it's fine, 11.09 fails - weird!!

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Copy/Paste
Posted: Thu Oct 13, 2011 11:04 AM

Peter,

We are working on unicode support for GETs and it seems as I may have emailed you a modified FiveHC.lib that has a change for unicode and thats where the problem is coming from.

Please check that in FWH\source\winapi\clpbrd.c you don't have this:

HB_FUNC( GETCLPDATA ) // GETCLIPBOARDDATA( nFormat ) --> uData
{
   WORD wType = hb_parni( 1 );
   HGLOBAL hMem;

   // if( ( wType == CF_TEXT ) && ( EnumClipboardFormats( CF_TEXT ) != 0 ) )
   //    wType = CF_UNICODETEXT;
   
   ...

The bug seems to come from Windows EnumClipboardFormats() or maybe we are using it in a wrong way. I email you a modified FiveHC.lib

Thanks,

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Copy/Paste
Posted: Thu Oct 13, 2011 11:06 AM

We are changing the previous code into this:

   
   if( ( wType == CF_TEXT ) && ( EnumClipboardFormats( CF_TEXT ) == CF_UNICODETEXT ) )
      wType = CF_UNICODETEXT;

It seems to be working fine now :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Copy/Paste
Posted: Thu Oct 13, 2011 11:16 AM

Nope, we have to remove it for now. After copying an unicode text and then a normal text, it keeps reporting unicode...

// if( ( wType == CF_TEXT ) && ( EnumClipboardFormats( 0 ) == CF_UNICODETEXT ) )
// wType = CF_UNICODETEXT;

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: Copy/Paste
Posted: Fri Oct 14, 2011 08:27 AM

I found another bug. I modified the sample this way:

    
    #include "FiveWin.ch"
    Function Main()

        Local oDlg,oGet1,oGet2,cVar1:="Test clipboard", cVar2:=space(30)
       
        DEFINE DIALOG oDlg TITLE "Testing Copy Paste"
       
            @01,01 GET oGet1 VAR cVar1 SIZE 100,12
            @03,01 GET oGet2 VAR cVar2 SIZE 100,12
       
        ACTIVATE DIALOG oDlg
         
    Return nil

First:
If you mark the text in the first get and try to insert another text from the clipboard, the old text should be replaced with the new one, but nothing happens. The old text is still there.

Second:
Write some text in the second get, mark this text and insert the text from the clipboard. The old text is not replaced, but the new one is appended to the old one.

kind regards

Stefan
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Copy/Paste
Posted: Fri Oct 14, 2011 05:57 PM

Stefan,

Class TGet was not properly processing WM_PASTE when some text was previously selected.

This is the fix for it:

So this is the right code to use:

      
      case nMsg == WM_PASTE
           if GetFocus() == ::hWnd
              CallWindowProc( ::nOldProc, ::hWnd, WM_PASTE, 0, 0 )
              ::oGet:Buffer = GetWindowText( ::hWnd )
              ::oGet:Pos = GetCaretPos()[ 2 ]
              ::oGet:Assign()
              if ::bChange != nil
                 Eval( ::bChange,,, Self )
              endif
           endif
           return 0

Thanks! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Copy/Paste
Posted: Fri Oct 14, 2011 06:12 PM
It seems as this change is also required under some circunstances, anyhow I appreciate if you test it and provide your feedback, thanks :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: Copy/Paste
Posted: Sat Oct 15, 2011 03:51 PM

Antonio,

the sample is working fine now, thanks :D

kind regards

Stefan
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Copy/Paste
Posted: Mon Oct 17, 2011 08:25 AM

Any updates on this? The code change above didnt solve my problem i'm afraid

best regards,

Pete

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Copy/Paste
Posted: Mon Oct 17, 2011 10:06 AM

Pete,

The posted code seems to work fine, maybe you have not updated your lib properly.

We can send you the modified libs if you want to, thanks :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: Copy/Paste
Posted: Mon Oct 17, 2011 10:11 AM

If you can send me the lib that would be great thanks

I'll let you know how I get on

regards,

Pete