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