Copy/Paste

Copy/Paste

Postby Gary Woodley » Wed Oct 12, 2011 2: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
Gary Woodley
 
Posts: 28
Joined: Mon Apr 27, 2009 3:37 pm
Location: Oxford UK

Re: Copy/Paste

Postby anserkk » Thu Oct 13, 2011 4:03 am

Here copy paste is working fine. Tested with FWH ver 11.09
Code: Select all  Expand view
#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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Copy/Paste

Postby PeterHarmes » Thu Oct 13, 2011 8: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
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Copy/Paste

Postby Richard Chidiak » Thu Oct 13, 2011 8: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Re: Copy/Paste

Postby PeterHarmes » Thu Oct 13, 2011 8: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!!
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Copy/Paste

Postby Antonio Linares » 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:

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

Re: Copy/Paste

Postby Antonio Linares » Thu Oct 13, 2011 11:06 am

We are changing the previous code into this:

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

Re: Copy/Paste

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Copy/Paste

Postby StefanHaupt » Fri Oct 14, 2011 8:27 am

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

Code: Select all  Expand view
   #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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Copy/Paste

Postby Antonio Linares » Fri Oct 14, 2011 5:57 pm

Stefan,

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

This is the fix for it:
Image

So this is the right code to use:
Code: Select all  Expand view
     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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Copy/Paste

Postby Antonio Linares » Fri Oct 14, 2011 6: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 :-)

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Copy/Paste

Postby StefanHaupt » Sat Oct 15, 2011 3:51 pm

Antonio,

the sample is working fine now, thanks :D
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Copy/Paste

Postby PeterHarmes » Mon Oct 17, 2011 8:25 am

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

best regards,

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Copy/Paste

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Copy/Paste

Postby PeterHarmes » 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
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 56 guests