Page 1 of 1
Paste into get
Posted: Tue Aug 24, 2021 3:33 am
by rhlawek
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
Re: Paste into get
Posted: Wed Aug 25, 2021 3:56 pm
by nageswaragunupudi
Please try this program
Code: Select all | Expand
#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
//----------------------------------------------------------------------------//

Re: Paste into get
Posted: Wed Aug 25, 2021 7:47 pm
by rhlawek
Perfect, thank you.
Robb