How to implement Clipboard support, in text mode apps

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
HGAutomator
Posts: 202
Joined: Thu Jul 16, 2020 5:42 pm
DBs Used: DBF

How to implement Clipboard support, in text mode apps

Post 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?
User avatar
danielmaximiliano
Posts: 2763
Joined: Fri Apr 09, 2010 4:53 pm
DBs Used: DBF
Location: Argentina
Contact:

Re: How to implement Clipboard support, in text mode apps

Post by danielmaximiliano »

puede ser

Code: Select all

 System.Clipboard := Datos_poliza
Datos_poliza := system.clipboard 
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Telegram invitation https://t.me/HMGWorkspace
HGAutomator
Posts: 202
Joined: Thu Jul 16, 2020 5:42 pm
DBs Used: DBF

Re: How to implement Clipboard support, in text mode apps

Post 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 
HGAutomator
Posts: 202
Joined: Thu Jul 16, 2020 5:42 pm
DBs Used: DBF

Re: How to implement Clipboard support, in text mode apps

Post 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
       } )
Post Reply