Page 1 of 2
Copy/Paste
Posted: Wed Oct 12, 2011 2:37 pm
by Gary Woodley
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
Re: Copy/Paste
Posted: Thu Oct 13, 2011 4:03 am
by anserkk
Here copy paste is working fine. Tested with FWH ver 11.09
Code: Select all
#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
Re: Copy/Paste
Posted: Thu Oct 13, 2011 8:01 am
by PeterHarmes
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
Re: Copy/Paste
Posted: Thu Oct 13, 2011 8:37 am
by Richard Chidiak
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
Re: Copy/Paste
Posted: Thu Oct 13, 2011 8:45 am
by PeterHarmes
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!!
Re: Copy/Paste
Posted: Thu Oct 13, 2011 11:04 am
by Antonio Linares
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
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,
Re: Copy/Paste
Posted: Thu Oct 13, 2011 11:06 am
by Antonio Linares
We are changing the previous code into this:
Code: Select all
if( ( wType == CF_TEXT ) && ( EnumClipboardFormats( CF_TEXT ) == CF_UNICODETEXT ) )
wType = CF_UNICODETEXT;
It seems to be working fine now
Re: Copy/Paste
Posted: Thu Oct 13, 2011 11:16 am
by Antonio Linares
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;
Re: Copy/Paste
Posted: Fri Oct 14, 2011 8:27 am
by StefanHaupt
I found another bug. I modified the sample this way:
Code: Select all
#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.
Re: Copy/Paste
Posted: Fri Oct 14, 2011 5:57 pm
by Antonio Linares
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:
Code: Select all
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!
Re: Copy/Paste
Posted: Fri Oct 14, 2011 6:12 pm
by Antonio Linares
It seems as this change is also required under some circunstances, anyhow I appreciate if you test it and provide your feedback, thanks
Re: Copy/Paste
Posted: Sat Oct 15, 2011 3:51 pm
by StefanHaupt
Antonio,
the sample is working fine now, thanks
Re: Copy/Paste
Posted: Mon Oct 17, 2011 8:25 am
by PeterHarmes
Any updates on this? The code change above didnt solve my problem i'm afraid
best regards,
Pete
Re: Copy/Paste
Posted: Mon Oct 17, 2011 10:06 am
by Antonio Linares
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
Re: Copy/Paste
Posted: Mon Oct 17, 2011 10:11 am
by PeterHarmes
If you can send me the lib that would be great thanks
I'll let you know how I get on
regards,
Pete