THANKs for your nice hint !
Overlooked this possibility, just integrated it also into my getsys.
Cause of overlapping same keycode K_INS and K_CTRL_V, i changed the original task for K_INS (change input mode) to key K_CTRL_I.
Works here fine for me, even with special language chars.
I use the developer (nightly) version of Harbour.
I assume ! that you can type direct per keyboard your special chars.
I'm NOT sure, especially with your CP's and terminal settings, but perhaps 'play' a little bit before paste with HB_GTI_CLIPBOARDDATA and different 2 + 3 parameter of HB_Translate().
hb_gtinfo( HB_GTI_CLIPBOARDDATA, HB_Translate(hb_gtinfo( HB_GTI_CLIPBOARDDATA), "HR1250", "HR852"))
best regards
rolf
VERY very thanks !, Klas
for your hint - your example works if the inkey is processed immedeate as it
occurs - but ... what's about simulating inkey with HB_KEYPUT() or even keyboard macros i'm working with sooo long ?? - another fred ...
###
When using hb_gtinfo( HB_GTI_CLIPBOARDPASTE ), the content is like 'typed' in.
If the clipboard contain MORE than one line of text, additional work is to be done: we have to remove a CHR(10) from DOS/WIN EndOfLine char-pair OR convert a single Linux CHR(10) to a CHR(13). This can be done by modifying the clipboard with hb_gtinfo( HB_GTI_CLIPBOARDDATA)).
i.e. using a cTmp help var - and these uppermost famous string functions from clipper tools (link with -hbct):
* is something there to fetch ?
IF ! EMPTY(cTmp := hb_gtinfo( HB_GTI_CLIPBOARDDATA))
* eol chars in it ?
IF CHR(10)$cTmp .OR. CHR(13)$cTmp
* single chr(10) -> chr(13); CHR(13)+CHR(10) -> CHR(13)
IF ! CHR(13)$cTmp
* convert all chr(10)
cTmp := CHARREPL(CHR(10), cTmp, CHR(13), .F.)
ELSE
* replace ALL chr(10)+chr(13) pairs to chr(13)
cTmp := ATREPL(CHR(13) + CHR(10), cTmp, CHR(13), NUMAT(CHR(13)+CHR(10),cTmp), .F.) //alle ersetzen
ENDIF
* modify clipboard buffer
hb_gtinfo( HB_GTI_CLIPBOARDDATA, cTmp)
ENDIF
ENDIF
* type it ...
hb_gtinfo( HB_GTI_CLIPBOARDPASTE )
-----
For a single get-field i do NOT want to have multiline input. Also we can push it direct into the get:buffer. Just at the position we are standing, depending on input-overwrite mode. To be done in getsys.prg:
* remark: get buffer are ALWAYS of type "C"haracter
* something there with the correct data type
IF ! EMPTY(hb_gtinfo( HB_GTI_CLIPBOARDDATA)) .AND. VALTYPE(hb_gtinfo( HB_GTI_CLIPBOARDDATA)) == VALTYPE(get:buffer)
cTmp := hb_gtinfo( HB_GTI_CLIPBOARDDATA)
* get all before -any- EOL-char
IF CHR(13)$cTmp
cTmp := LEFT( cTmp, AT(CHR(13), cTmp) - 1)
ENDIF
IF CHR(10)$cTmp
cTmp := LEFT( cTmp, AT(CHR(10), cTmp) - 1)
ENDIF
* anything left ? - insert it
IF ! EMPTY(cTmp)
IF get:pos > 1
get:buffer := LEFT(;
SUBSTR(get:buffer, 1, get:pos -1) + ;
cTmp + ;
SUBSTR(get:buffer, IF( Set( _SET_INSERT), get:pos, get:pos + LEN(cTmp))),;
LEN(get:buffer))
ELSE
get:buffer := LEFT( cTmp + SUBSTR( get:buffer, IF( Set( _SET_INSERT), 1, LEN(cTmp) +1)), LEN(get:buffer))
ENDIF
* two needed steps to make our buffer assigned and visible
get:assign()
get:display()
ENDIF
ENDIF
best regards
Rolf
When using hb_gtinfo( HB_GTI_CLIPBOARDPASTE ), the content is like 'typed' in.
If the clipboard contain MORE than one line of text, additional work is to be done: we have to remove a CHR(10) from DOS/WIN EndOfLine char-pair OR convert a single Linux CHR(10) to a CHR(13). This can be done by modifying the clipboard with hb_gtinfo( HB_GTI_CLIPBOARDDATA)).
So I have an idea for the question of the Linux [LF] or Windows [CRLF] or old I/OS [CR].
What about replacing it by ";" and open the possibility of multi-GET paste?
What I did here was to have 2 possible keys to paste (Ctrl-V and Ctrl-P), with Ctrl-V for multi-GET and Ctrl-P for only one GET.
Just to give someone one more option :)