Clipboard question

Clipboard question

Postby rhlawek » Thu Jan 20, 2022 2:13 am

A couple months ago I incorporated a change from this forum, basic code below, to be able to fetch the clipboard contents, edit it, then put the edited version into the get . This stopped working with the last update, in the following code it crashes on the oClp:Open() line, giving me a TGet():MsgNotFound(0) error. What might have changed in fivewin to cause this to start happening, and what is the solution?

Code: Select all  Expand view


// oSegment is a get
oSegment:bGotFocus := { |oClp| ColToString( oClp ) }

STATIC PROCEDURE ColToString( oClp )

   LOCAL cText

   IF oClp:Open() <<== Crashes with TGet():MsgNotFound(0) here
      cText := AllTrim( oClp:GetText() )
      IF cText != NIL
         IF _LF $ cText
            cText := StrTran( cText, _CRLF, _LF )
            cText := StrTran( cText, _LF, "," )
            cText := StrTran( cText, " ", "," )
            cText := AllTrim( cText )
            DO WHILE Right( cText, 01 ) == ","
                cText := RTrim( Left( cText, Len( cText ) - 1 ) )
            ENDDO
            oClp:Clear()
            oClp:SetText( cText )
         ENDIF
      ENDIF
      oClp:Close()
   ENDIF

RETURN

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

Re: Clipboard question

Postby Antonio Linares » Thu Jan 20, 2022 6:49 am

Robert,

Please modify this line this way:

oSegment:bGotFocus := { |oClp| ColToString() } // We don't provide oClp as a param, which it is a TGet object to function ColToString()

that way, oClp will arrive as a nil to function ColToString() and there should be no error TGet():MsgNotFound(0)

also you need to define a local oClp := TClipboard():New() inside function ColToString()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 72 guests