Page 1 of 1
How to implement Clipboard support, in text mode apps
Posted: Mon Sep 12, 2022 4:30 pm
by HGAutomator
Hi,
It appears that the default for READ in Harbour, is not to accept Ctrl V or Shift Ins, in order to copy the clipboard.
A MiniGui example is in c:\minigui\samples\BASIC\ConsoleToGUI. There are several GET objects and a Read, but the standard Clipboard features are not in effect.
Do we need to set a Hot Key to a SendKey function with the Clipboard contents?
Re: How to implement Clipboard support, in text mode apps
Posted: Tue Sep 13, 2022 1:10 am
by danielmaximiliano
puede ser
Code: Select all
System.Clipboard := Datos_poliza
Datos_poliza := system.clipboard
Re: How to implement Clipboard support, in text mode apps
Posted: Tue Sep 13, 2022 1:21 am
by HGAutomator
Thanks Daniel, but this isn't my question. I already know how to refer to the clipboard, store it in a variable, send it to a file, all of that.
I'm trying to find out how we paste the clipboard contents into a GET-READ field, in text mode. Ctrl-V doesn't work. Neither does Shift-Ins.
danielmaximiliano wrote: ↑Tue Sep 13, 2022 1:10 am
puede ser
Code: Select all
System.Clipboard := Datos_poliza
Datos_poliza := system.clipboard
Re: How to implement Clipboard support, in text mode apps
Posted: Tue Sep 13, 2022 1:50 am
by HGAutomator
It looks like it does come down to setting some hot keys.
https://groups.google.com/g/harbour-users/c/xr3iM2vbxi8
Code: Select all
#include "hbgtinfo.ch"
#include "inkey.ch"
hb_gtInfo( HB_GTI_INKEYFILTER, { | nKey |
LOCAL nBits, lIsKeyCtrl
SWITCH nKey
CASE K_MWBACKWARD
RETURN K_DOWN
CASE K_MWFORWARD
RETURN K_UP
CASE K_RBUTTONDOWN
RETURN K_ESC
CASE K_RDBLCLK
RETURN K_ESC
CASE K_CTRL_V
nBits := hb_GtInfo( HB_GTI_KBDSHIFTS )
lIsKeyCtrl := ( nBits == hb_BitOr( nBits, HB_GTI_KBD_CTRL ) )
IF lIsKeyCtrl
hb_GtInfo( HB_GTI_CLIPBOARDPASTE )
RETURN 0
ENDIF
CASE K_CTRL_C
nBits := hb_gtInfo( HB_GTI_KBDSHIFTS )
lIsKeyCtrl := ( nBits == hb_BitOr( nBits, HB_GTI_KBD_CTRL ) )
IF lIsKeyCtrl
MsgExclamation( "Copado para área de transferência" )
IF GetActive() != NIL
hb_gtInfo( HB_GTI_CLIPBOARDDATA, Transform( GetActive():VarGet(), "" ) )
RETURN 0
ENDIF
ENDIF
ENDSWITCH
RETURN nKey
} )