GET COPY/PASTE and crlf

GET COPY/PASTE and crlf

Postby MarcoBoschi » Wed Nov 02, 2011 1:54 pm

Hi,
If a select the text in oGet1 and press CTRL_C
Then I move in the second get oGet2
And Press CTRL_V
I find only "Marco "

Any hints?

marco


Code: Select all  Expand view
#include "fivewin.ch"

#define crlf CHR(13)+CHR(10)


FUNCTION main()
   local oDlg
   local oGet1  , cGet1  := "Marco " + crlf + "Boschi     "
   local oGet2  , cGet2  := "Enrico Maria Giordano        "
   define dialog oDlg

   @ 1,1 get oGet1 var cGet1 of oDlg

   @ 2,1 get oGet2 var cGet2 of oDlg

   ACTIVATE DIALOG oDlg CENTER

return nil
 
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: GET COPY/PASTE and crlf

Postby James Bott » Wed Nov 02, 2011 2:42 pm

Try making both of the GETs multiline.

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

Re: GET COPY/PASTE and crlf

Postby MarcoBoschi » Wed Nov 02, 2011 3:14 pm

James,
it works!
But I need single line get objects.
The problem is to allow paste text after removing crlf.

marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: GET COPY/PASTE and crlf

Postby James Bott » Wed Nov 02, 2011 4:18 pm

Note that a "multiline" Get can actually be only one line high. "Multiline" is a property not a dimension (in this case).

Please explain why you would have a CRLF in a Get that is only one line high, and in more detail what you are trying to do.

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

Re: GET COPY/PASTE and crlf

Postby MarcoBoschi » Wed Nov 02, 2011 5:29 pm

James,
I have several gets for free notes.
Sometimes user copy from web pages text in one or more lines and paste it into a single line get.

If the solution is to use in these gets "multiline" property how have I to define them?

Many thanks

marco

FUNCTION main()
local oDlg
local oGet1 , cGet1 := "Marco "
local oGet2 , cGet2 := "Enrico Maria Giordano "
define dialog oDlg

@ 1,1 get oGet1 var cGet1 of oDlg

@ 2,1 get oGet2 var cGet2 of oDlg

ACTIVATE DIALOG oDlg CENTER

return nil
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: GET COPY/PASTE and crlf

Postby Enrico Maria Giordano » Wed Nov 02, 2011 7:28 pm

Your sample works fine here using FWH 11.09.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: GET COPY/PASTE and crlf

Postby MarcoBoschi » Wed Nov 02, 2011 9:07 pm

EMG,
did you test the first sample?
The one containing crlf in the first get?
King regards
marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: GET COPY/PASTE and crlf

Postby James Bott » Wed Nov 02, 2011 9:53 pm

Marco,

The first problem is that the field length for the second field wasn't long enough so the data was getting truncated and it appeared that the CRLF was causing it. Try this:

Code: Select all  Expand view
#include "fivewin.ch"

FUNCTION main()
   local oDlg
   local oGet1  , cGet1  := "Marco " + CRLF + "Boschi     "
   local oGet2  , cGet2  := "Enrico Maria Giordano                  " // longer

   define dialog oDlg

   @ 1,1 get oGet1 var cGet1 of oDlg

   @ 2,1 get oGet2 var cGet2 of oDlg

    ACTIVATE DIALOG oDlg CENTER

return nil

Now with the longer field you can use bChange to strip out the CRLF's:

Code: Select all  Expand view
#include "fivewin.ch"

FUNCTION main()
   local oDlg
   local oGet1  , cGet1  := "Marco " + CRLF + "Boschi     "
   local oGet2  , cGet2  := "Enrico Maria Giordano                  "

   define dialog oDlg

   @ 1,1 get oGet1 var cGet1 of oDlg

   @ 2,1 get oGet2 var cGet2 of oDlg

    oGet2:bChange := {|,,o| o:oGet:buffer := strtran(o:oGet:buffer,CRLF,"") }

   ACTIVATE DIALOG oDlg CENTER

return nil


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

Re: GET COPY/PASTE and crlf

Postby Enrico Maria Giordano » Wed Nov 02, 2011 10:30 pm

MarcoBoschi wrote:EMG,
did you test the first sample?
The one containing crlf in the first get?


Yes.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: GET COPY/PASTE and crlf

Postby MarcoBoschi » Thu Nov 03, 2011 8:38 am

James,
I've compiled your last posted code
I have this error
Probably I'm using a too old version of fwh
Many thanks

marco
this is the error

Application
===========
Path and name: C:\gc\james.exe (32 bits)
Size: 1,902,592 bytes
Time from start: 0 hours 0 mins 10 secs
Error occurred at: 11/03/11, 09:37:00
Error description: Error BASE/1126 Argument error: STRTRAN
Args:
[ 1] = U
[ 2] = C

[ 3] = C

Stack Calls
===========
Called from: => STRTRAN(0)
Called from: james.prg => (b)MAIN(16)
Called from: tget.prg => TGET:KEYCHAR(1091)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: control.prg => TCONTROL:HANDLEEVENT(1469)
Called from: tget.prg => TGET:HANDLEEVENT(586)
Called from: .\source\classes\WINDOW.PRG => _FWH(3347)
Called from: => DIALOGBOXINDIRECT(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
Called from: james.prg => MAIN(18)
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: GET COPY/PASTE and crlf

Postby MarcoBoschi » Thu Nov 03, 2011 8:39 am

To EMG,
Please could you send me this little sample compiled with new version?
I have to verify how many *little* problems are solved.

Thank you

#include "fivewin.ch"

#define crlf CHR(13)+CHR(10)

FUNCTION main()
local oDlg
local oGet1 , cGet1 := "Marco Boschi "
local oGet2 , cGet2 := "Enrico Maria Giordano "

define dialog oDlg

@ 1,1 get oGet1 var cGet1 of oDlg

@ 2,1 get oGet2 var cGet2 of oDlg

ACTIVATE DIALOG oDlg CENTER

return nil
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: GET COPY/PASTE and crlf

Postby Enrico Maria Giordano » Thu Nov 03, 2011 9:28 am

Please note that this second sample doesn't use CRLF. Do you want me to compile this new version or the first version that started this topic?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: GET COPY/PASTE and crlf

Postby MarcoBoschi » Thu Nov 03, 2011 9:34 am

It's the same
thanks
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy


Re: GET COPY/PASTE and crlf

Postby MarcoBoschi » Thu Nov 03, 2011 12:45 pm

Thanks

marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 108 guests