Silverfrost Forums

Welcome to our forums

How to copy/paste in an edit box (%m.neb) ?

22 Nov 2011 6:14 #9259

I don't want to waste your time with something that's probably documented in the Help files for FTN95. But I haven't found it yet.

Can I get you to give me a hint where in the Help files this is? I can chase it from there.

I am using an edit box (%m.neb) to display a text buffer with a lot of text in it. I highlighted some of the text with the mouse, then hit Ctl-C to copy, then clicked in another edit box and hit Ctl-V to paste a copy of that highlighted text. But the Ctl-V gave me some old data that I had copied long ago from the Fortram program itself in Plato. Evidently the Ctl-C I had used in the Edit Box, didn't do any copying.

Are there extra commands or option etc. that I have to go through, to give my Edit Bos the ability to do this copy/pasting?

No need to detail exactly what the commands are. Can you simply point me to the section(s) of the Help files that describe how to do this?

Muchas gracias!

22 Nov 2011 7:52 #9260

First I would try attaching the standard callback COPY to an accelerator key using %ac. At a guess it would look like...

iw = winio@('%ac[Ctrl+C]&', 'COPY')

22 Nov 2011 7:53 #9264

Quoted from PaulLaidler First I would try attaching the standard callback COPY to an accelerator key using %ac. At a guess it would look like...

iw = winio@('%ac[Ctrl+C]&', 'COPY')

Thank you, Paul, this works! 😃

I did run into a slightly different problem. The Help files have a small, simple text editor that I typed in, and then added accelerator keys for CUT, COPY, and PASTE, and put the whole thing into a subroutine.

CUT and COPY work fine. But when I CUT and then try to PASTE, I get a run-time error message saying I have exceeded the buffer.

My guess is that the buffer is always kept full-length. I initially declared it to be 32,000 characters. Then I put a few hundred characters into it. I'd imagine the system then padded those characrters with some 30,000 blanks on the right.

When I CUT, it shifts any characters past the highlighted section, to the left to overwrite the highlighted section... and then I'd guess it pads on the far right end of the buffer with blanks to keep the buffer full length. And then when I PASTE, it tries to lengthen the buffer, running into the buffer-size limit. Or so I'm guessing.

Am I missing something in the correct way to use the PASTE command?

      WINAPP
      
      CHARACTER*32000 Textstg

      Textstg='This is the string I want to try out in the text editor.' 
     1  //' I hope it comes out OK, but you never know when you try '
     2  //'something for the first time.'//CHAR(10)//CHAR(10)
     3  //'This is hopefully a new line. I wonder if I can cut/paste'
     4  //' it to a different place.'

      CALL EDWINDOW(Textstg)

      STOP
      END

      
      SUBROUTINE EDWINDOW(edstg)
      CHARACTER*(*) edstg
      INTEGER i,winio@
      CHARACTER*250 file,new_file,help_file
      istgsize=LEN(edstg)
      help_file='myhelp.hlp'
      i=winio@('%mn[&File[&Open]]&','EDIT_FILE_OPEN','*.*',file)
      i=winio@('%mn[[&Save]]&','EDIT_FILE_SAVE','*.*',new_file)
      i=winio@('%mn[[Save &As]]&','EDIT_FILE_SAVE_AS','*.*',new_file)
      i=winio@('%mn[[E&xit]]&','EXIT')
      i=winio@('%mn[&Edit[Cu&t]]&','CUT')
      i=winio@('%mn[[&Paste]]&','PASTE')
      i=winio@('%mn[&Help[&Contents]]&','HELP_CONTENTS',help_file)
      i=winio@('%mn[[&Help on help]]&','HELP_ON_HELP',help_file)
      i=winio@('%ac[Ctrl+X]&','CUT')
      i=winio@('%ac[Ctrl+C]&','COPY')
      i=winio@('%ac[Ctrl+V]&','PASTE')
      i=winio@('%80.40eb',edstg,istgsize)
      END
23 Nov 2011 11:32 #9273

Yes there does appear to be a problem here.

If you can work with a buffer size of zero then it seems to work OK.

You will not be able to set the initial text as the library will provide the buffer.

Please login to reply.