FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Paste into get
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM

Paste into get

Posted: Tue Aug 24, 2021 03: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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Paste into get

Posted: Wed Aug 25, 2021 03:56 PM
Please try this program
Code (fw): Select all Collapse
#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

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


Regards



G. N. Rao.

Hyderabad, India
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM

Re: Paste into get

Posted: Wed Aug 25, 2021 07:47 PM

Perfect, thank you.

Robb

Continue the discussion