Paste into get

Paste into get

Postby rhlawek » Tue Aug 24, 2021 3:33 am

I want to select a column of values from excel, copy to the clipboard, then paste that selection into a get where they are inserted into the get as either space or comma separated values. Where can I intercept what is on the clipboard to edit it to insert what I need into the get?

Robb
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: Paste into get

Postby nageswaragunupudi » Wed Aug 25, 2021 3:56 pm

Please try this program
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local aText[ 3 ], aGet[ 3 ]
   local oDlg, oFont, oClp

   AFill( aText, Space( 40 ) )
   SetGetColorFocus()

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 400,230 PIXEL TRUEPIXEL
   DEFINE CLIPBOARD oClp OF oDlg FORMAT TEXT

   @  60,20 GET aGet[ 1 ] VAR aText[ 1 ] SIZE 360,26 PIXEL OF oDlg
   @  95,20 GET aGet[ 2 ] VAR aText[ 2 ] SIZE 360,26 PIXEL OF oDlg
   @ 130,20 GET aGet[ 3 ] VAR aText[ 3 ] SIZE 360,26 PIXEL OF oDlg

   @ 170,20 BUTTON "OK" SIZE 100,30 PIXEL OF oDlg ACTION oDlg:End()

   AEval( aGet, { |oGet| oGet:bGotFocus := { |o|FnGotFocus( o, oClp ) } } )

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

   XBROWSER aText

return nil

//----------------------------------------------------------------------------//

static function FnGotFocus( o, oClp )

   local cText

   if oClp:Open()
      cText    := oClp:GetText()
      if cText != nil
         if CHR( 10 ) $ cText
            cText    := StrTran( cText, CRLF, CHR(10) )
            cText    := StrTran( cText, CHR(10), ", " )
            oClp:Clear()
            oClp:SetText( cText )
         endif
      endif
      oClp:Close()
   endif

return nil

//----------------------------------------------------------------------------//
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10619
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Paste into get

Postby rhlawek » Wed Aug 25, 2021 7:47 pm

Perfect, thank you.

Robb
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 51 guests