Author | Topic: SET TYPRAHRAD masimum value? | |
---|---|---|
Tim Callahan | SET TYPRAHRAD masimum value? on Fri, 17 Aug 2018 13:51:22 -0700 Hello, I am using a TYPEAHEAD buffer size of 200 to support a clipboard paste operation in memo fields and have had no issues. xBase docs say 100 is the masimum or the app may become uncontollable. I'd like to go higher, say 400, and wondered if anyone has experience with this of if perhaps the limit has changed with an upgrade since the docs were written. Thanks, Tim | |
Jim Lee | Re: SET TYPRAHRAD masimum value? on Sat, 18 Aug 2018 03:01:15 +0200 hi, > I am using a TYPEAHEAD buffer size of 200 to support a clipboard paste > operation in memo fields and have had no issues. are you using KEYBOARD to stuff it into Memo ? if you use Hybrid Mode /PM:PM you can use \SOURCE\SYS\GetSysX.prg make a Copy and modify it this Way CASE nEvent == xbeK_CTRL_U oGet:undo() ad new Copy to Clipboard CASE nEvent == xbeK_CTRL_C Copy2Clipboard oClipBoard := XbpClipBoard():new():create() oClipBoard:open() cText := oGet:buffer oClipBoard:setBuffer(cText, XBPCLPBRD_TEXT) oClipBoard:close() oClipBoard:destroy() Copy from Clipboard CASE nEvent == xbeK_CTRL_V Insert oClipBoard := XbpClipBoard() :new() :create() oClipBoard:open() aFormats := OClipBoard:queryFormats() IF ASCAN( aFormats, XBPCLPBRD_TEXT ) > 0 cText := oClipBoard:getBuffer( XBPCLPBRD_TEXT ) n := LEN( cText ) FOR i := 1 TO n cChar := cText[ i ] /* Transfer character to edit buffer */ IF SET( _SET_INSERT ) oGet:insert( cChar ) ELSE oGet:overstrike( cChar ) ENDIF /* No room left to type to the right of the cursor */ IF oGet:typeOut IF SET( _SET_BELL ) QQOUT( CHR( 7 ) ) ENDIF IF !SET( _SET_CONFIRM ) oGet:exitState := GE_ENTER ENDIF EXIT ENDIF NEXT i ENDIF oClipBoard:close() oClipBoard:destroy() OTHERWISE Note : if sign missing try some SLEEP() in loop | |
Tim Callahan | Re: SET TYPRAHRAD masimum value? on Sun, 19 Aug 2018 15:33:36 -0700 Thnaks very much for the tip. I was using this to stuff the keyboard buffer within a memoedit user function that was trapping the paste keystroke. I used a variant of your suggestion where the paste key set a flag and exiis the memoedit. The flag is detected and the memo edit buffer is set to the clipboard contents and the memoedit is restarted with the new contents. The time delay with setting the buffer and restarting the memoedit is fast enough that there is no flicker on the screen. Thanks - you pointed me in the right direction. Tim On Sat, 18 Aug 2018 03:01:15 +0200, Jim Lee wrote: >hi, > >> I am using a TYPEAHEAD buffer size of 200 to support a clipboard paste >> operation in memo fields and have had no issues. > >are you using KEYBOARD to stuff it into Memo ? > >if you use Hybrid Mode /PM:PM you can use \SOURCE\SYS\GetSysX.prg >make a Copy and modify it this Way > > CASE nEvent == xbeK_CTRL_U > oGet:undo() > >// ad new > Copy to Clipboard > CASE nEvent == xbeK_CTRL_C >Copy2Clipboard > oClipBoard := XbpClipBoard():new():create() > oClipBoard:open() > cText := oGet:buffer > oClipBoard:setBuffer(cText, XBPCLPBRD_TEXT) > oClipBoard:close() > oClipBoard:destroy() > > Copy from Clipboard > CASE nEvent == xbeK_CTRL_V Insert > oClipBoard := XbpClipBoard() :new() :create() > oClipBoard:open() > aFormats := OClipBoard:queryFormats() > IF ASCAN( aFormats, XBPCLPBRD_TEXT ) > 0 > cText := oClipBoard:getBuffer( XBPCLPBRD_TEXT ) > n := LEN( cText ) > FOR i := 1 TO n > cChar := cText[ i ] > /* Transfer character to edit buffer */ > IF SET( _SET_INSERT ) > oGet:insert( cChar ) > ELSE > oGet:overstrike( cChar ) > ENDIF > /* No room left to type to the right of the cursor */ > IF oGet:typeOut > IF SET( _SET_BELL ) > QQOUT( CHR( 7 ) ) > ENDIF > IF !SET( _SET_CONFIRM ) > oGet:exitState := GE_ENTER > ENDIF > EXIT > ENDIF > NEXT i > ENDIF > oClipBoard:close() > oClipBoard:destroy() > > OTHERWISE > >Note : if sign missing try some SLEEP() in loop > | |
Tim Callahan | Re: SET TYPRAHRAD masimum value? on Mon, 27 Aug 2018 13:19:18 -0700 I came up with a way to handle posting into a memo being edited by memoedit. It's all contained in the memoedit user function except for two static variables declared in the file. Thoughts I'd post the code. #INCLUDE "memoedit.CH" #INCLUDE "xbp.CH" #INCLUDE "appevent.CH" static slPasting static scPasteBuffer proc main local cMemo := '' cls memoedit(@cMemo,5,5,20,75,.t.,'MemoFunc') return Memoedit user function func MemoFunc(nMode,nLine,nColumn) local nEvent := LastAppEvent(),; nReturn := ME_DEFAULT DO CASE CASE nMode==ME_INIT slPasting := .f. CASE nMode==ME_IDLE Pasting - push the next character IF slPasting keyboard left(scPasteBuffer,1) scPasteBuffer := subs(scPasteBuffer, 2) IF len(scPasteBuffer)=0 slPasting := .f. ENDIF endif CASE nMode==ME_UNKEY .OR. nMode==ME_UNKEYX Ctrl-P to paste if nEvent==xbeK_CTRL_P scPasteBuffer := GetClipboard() Strip line feeds - memoedit does not handle - it expects just CR scPasteBuffer := strtran(scPasteBuffer,chr(10),'') IF len(scPasteBuffer) > 0 slPasting := .t. ENDIF endif END CASE RETURN nReturn Return text contents of the clipboard 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 | |
James Loughner | Re: SET TYPRAHRAD masimum value? on Fri, 17 Aug 2018 22:51:09 -0400 On 08/17/2018 04:51 PM, Tim Callahan wrote: > Hello, > I am using a TYPEAHEAD buffer size of 200 to support a clipboard paste > operation in memo fields and have had no issues. > xBase docs say 100 is the masimum or the app may become uncontollable. > I'd like to go higher, say 400, and wondered if anyone has experience > with this of if perhaps the limit has changed with an upgrade since > the docs were written. > Thanks, > Tim > TYPAHEAD is used as an input stack for all GUI events not just keyboard. If you stack too many then you can have apparent hangs until the stack runs out of events. Jim |