Author | Topic: MemoEdit Copy/Paste | |
---|---|---|
Jack Duijf | MemoEdit Copy/Paste on Tue, 15 Jan 2019 19:48:47 +0100 Hello, One of my customers still running a CRT app. Today i got request to enable Copy/Paste in MemoEdit() How can this be done? Regards Jack Duijf ------------------------------------------------------------- Also a member off the XXP (http://www.xxp.nl) | |
Jim Lee | Re: MemoEdit Copy/Paste on Tue, 15 Jan 2019 21:26:47 +0100 hi, > Today i got request to enable Copy/Paste in MemoEdit() > How can this be done? to copy from CMD-Box to Clipboard need to enable "Quick-Edit" Modus. --- for GET i have modify a Copy of \SOURCE\SYS\GetSys.prg and include 2 Function FUNCTION Copy2Clip( cText ) LOCAL oClipBoard IF PCOUNT() > 0 oClipBoard := XbpClipBoard() :new() :create() oClipBoard:open() oClipBoard:clear() oClipBoard:setBuffer( cText, XBPCLPBRD_TEXT ) oClipBoard:close() oClipBoard:destroy() ENDIF RETURN .T. FUNCTION Paste2CRT() LOCAL oClipBoard LOCAL aFormats LOCAL cText := "" oClipBoard := XbpClipBoard() :new() :create() oClipBoard:open() aFormats := OClipBoard:queryFormats() IF ASCAN( aFormats, XBPCLPBRD_TEXT ) > 0 cText := ALLTRIM( oClipBoard:getBuffer( XBPCLPBRD_TEXT ) ) KEYBOARD ( cText ) oClipBoard:close() oClipBoard:destroy() ENDIF RETURN .T. --- Diese E-Mail wurde von AVG auf Viren geprüft. http://www.avg.com | |
Jack Duijf | Re: MemoEdit Copy/Paste on Tue, 15 Jan 2019 22:19:56 +0100 Hello Jim, Thanks for the reply. I already did this before for regular GET input. I seem unable to do this for MemoEdit() funtion,. The max for SET TYPEAHEAD is 100. I want to select/mark text an COPY and PASTE from one MemoEdit() to another MemoEdit(). The text to copy could span to over 20 lines (1200 - 1600 characters) Do you have a solution for this too? Regards Jack Duijf ------------------------------------------------------------- Also a member off the XXP (http://www.xxp.nl) | |
Jim Lee | Re: MemoEdit Copy/Paste on Thu, 17 Jan 2019 00:22:15 +0100 hi, > I seem unable to do this for MemoEdit() funtion,. > The max for SET TYPEAHEAD is 100. what about write Clipboard to File and than MemoRead() ? --- Diese E-Mail wurde von AVG auf Viren geprüft. http://www.avg.com | |
Tim Callahan | Re: MemoEdit Copy/Paste on Sat, 02 Mar 2019 14:01:02 -0800 Hi - I know this is an older post but here's a way to do it within the memoedit user function that avoids the SET TYPEAHEAD length contstraint. I extracted this code but didn't compile but it shows the tec;hnique. HTH, Tim #INCLUDE "appevent.CH" #INCLUDE "memoedit.ch" #INCLUDE "xbp.ch" static slPasting static slPasteBuffer proc main local cMemo := '' memoedit(cMemo, 5, 10, 20, 70, , 'MemoKey') return FUNCTION MemoKey(nMode, nLine,nColumn) Mouse memo edit key handler local nReturn := ME_DEFAULT,; nEvent := LastAppEvent() Process memoedit states DO CASE CASE nMode==ME_INIT slPasting := .f. nReturn := ME_DEFAULT CASE nMode==ME_IDLE If we're pasting push the next character from the paste buffer IF slPasting Don't send line feeds as memoedit does not handle them properly The CRs that accompany them format properly as a new line in the memo keyboard left(scPasteBuffer,1) scPasteBuffer := subs(scPasteBuffer, 2) IF len(scPasteBuffer)=0 slPasting := .f. ENDIF endif nReturn := ME_DEFAULT CASE nMode==ME_UNKEY .OR. nMode==ME_UNKEYX Unknown or configurable key Paste clipboard with Ctrl-P if nEvent = xbeK_CTRL_P scPasteBuffer := trim(GetClipboard()) Remove line feeds - memoedit doesn't handle as input and single CR's format properly scPasteBuffer := strtran(scPasteBuffer, chr(10), '') Replace soft returns with space - force wapping in memoedit window scPasteBuffer := strtran(scPasteBuffer, chr(141), ' ') IF len(scPasteBuffer) > 0 slPasting := .t. ENDIF nReturn := ME_DEFAULT endif END CASE processing memoedit states RETURN nReturn Get text clipboard contents func GetClipboard() local cClipContent,; oClip oClip := xbpclipboard():new():create() oClip:open() cClipContent := oClip:GetBuffer(XBPCLPBRD_TEXT) IF cClipContent=NIL cClipContent := '' else cClipContent := trim(cClipContent) ENDIF oClip:close() oClip:destroy() return cClipContent On Tue, 15 Jan 2019 19:48:47 +0100, Jack Duijf wrote: >Hello, > >One of my customers still running a CRT app. >Today i got request to enable Copy/Paste in MemoEdit() > >How can this be done? > >Regards >Jack Duijf > >------------------------------------------------------------- >Also a member off the XXP (http://www.xxp.nl) |