Page 1 of 1

Problem with paste in Get

Posted: Mon Apr 30, 2018 2:46 pm
by José Luis Sánchez
Hello,

I've a persistent problem in my applications with the paste of the content of a GET field. When I paste a text in a get field, the text doesn't paste fully, it onnly paste part of the text. For example, in a bank account that in Spain is a char(24), when I paste a value - sometimes from another record of the same application -, FWH doesn't paste the 24 char, it only pastes 18. However, if first I select the field - I go the the beginning of the filed, pulse SHIFT+END selecting the spaces on the GET - and then pressing CTRL+V then the full length of the filed is pasted. If I show th length of the variable associated to the field with Len(cVar) it returns the correct value.

I always make my dialogs from resources, and get fields are EDITTEXT in the .rc file, for example
EDITTEXT 120, 458, 64, 40, 12

I don't know if it is somwthing I'm doing wrong because it's a very big problem and I never read something like this in the forum. ¿ Someone can help me ? Big thanks.

Regards,

José Luis

Re: Problem with paste in Get

Posted: Mon Apr 30, 2018 3:16 pm
by dtussman
I have this problem all the time

Re: Problem with paste in Get

Posted: Mon Apr 30, 2018 3:50 pm
by cnavarro

Re: Problem with paste in Get

Posted: Mon Apr 30, 2018 4:08 pm
by José Luis Sánchez
Thanks, but my field is text without format, and it's not the same issue.

Re: Problem with paste in Get

Posted: Mon Apr 30, 2018 5:05 pm
by nageswaragunupudi
18 is the hex value of 24

Re: Problem with paste in Get

Posted: Mon Apr 30, 2018 5:15 pm
by nageswaragunupudi
I made this small test and it appears working correctly for me.

Code: Select all

function TestPaste()

   local oDlg, oFont
   local c1, c2

   c1    := "ABCD" + CHR(24) + "EFGH"
   c2    := "ABCDXEFGH"

   DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-20

   DEFINE DIALOG oDlg SIZE 300,150 PIXEL TRUEPIXEL FONT oFont

   @ 20,20 GET c1 SIZE 200,30 PIXEL OF oDlg

   @ 50,20 GET c2 SIZE 200,30 PIXEL OF oDlg

   @ 99,20 BUTTON "Show" SIZE 100,40 PIXEL OF oDlg ;
      ACTION MsgInfo( STRTOHEX( c1 ) + CRLF + STRTOHEX( c2 ) + CRLF + ;
         If( c1 == c2, "SAME", "NOT SAME" ) )

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont

return nil
 
Before copy and paste:
Image

First, I blocked the five characters "CD" + CHR(24) + "EF" from the first Get and pressed Ctrl-C to copy.
Next, I blocked the five characters "CDXEF" in the second Get and pressed Ctrl-V to paste.
I found the paste working correctly.

After copy and paste:
Image

For me, the copy and paste appears to be working correctly.

Re: Problem with paste in Get

Posted: Mon Apr 30, 2018 10:28 pm
by dtussman
sometimes it works and sometimes it doesn't

Re: Problem with paste in Get

Posted: Tue May 01, 2018 11:46 am
by José Luis Sánchez
Mr. Rao:
Thanks for your kind answer. I've converted your sample using resources, and it works properly.

Code: Select all

#include "FiveWin.ch"

function Main()

    local oDlg, oFont, aGet[2], oBtn
    local c1, c2

    c1    := "ES9901234567890123456789"
    c2    := space(24)

    DEFINE FONT oFont NAME "Segoe UI" SIZE 0,-16

    DEFINE DIALOG oDlg RESOURCE "TEST" 
    oDlg:SetFont(oFont)

    REDEFINE GET aGet[1] VAR c1 ID 10 OF oDlg

    REDEFINE GET aGet[1] VAR c2 ID 11 OF oDlg
    
    REDEFINE BUTTON oBtn ID 12 OF oDlg ;
        ACTION MsgInfo( STRTOHEX( c1 ) + CRLF + STRTOHEX( c2 ) + CRLF + ;
            If( c1 == c2, "SAME", "NOT SAME" ) )

    ACTIVATE DIALOG oDlg CENTERED

    RELEASE FONT oFont

return nil
and the resource file is:

Code: Select all

// Generated by ResEdit 1.5.11
// Copyright (C) 2006-2012
// http://www.resedit.net

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "resource.h"




//
// Dialog resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
TEST DIALOG 61, 39, 241, 98
STYLE DS_3DLOOK | DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
CAPTION "TESTPASTE"
FONT 8, "Tahoma"
{
    EDITTEXT        10, 8, 19, 225, 16, ES_AUTOHSCROLL
    EDITTEXT        11, 8, 39, 225, 16, ES_AUTOHSCROLL
    DEFPUSHBUTTON   "Show", 12, 164, 67, 69, 23
}
I realized that the resource editor is including the clause ES_AUTOHSCROLL that I was not using in the resources in my programs. Then I've included this clause in .rc of one of my programs and it works fine. I've to change all the EDITTEXT to include the clause, but the problem is solved.

Big thanks, you have helped me to solve one of my BIG issues from FWH.

Regards from Novelda,
José Luis

Re: Problem with paste in Get

Posted: Wed May 02, 2018 10:02 am
by Antonio Linares
José Luis,

many thanks for your feedback