Using clipboard to copy text to Notepad

This forum is for general support of Xbase++
Post Reply
Message
Author
reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Using clipboard to copy text to Notepad

#1 Post by reganc »

I have done some quick code that I thought would just work, but for some reason it doesn't.

Code: Select all

   cText := Get_Report_As_Text()
   oClipBoard := XbpClipboard():new():create()
   oClipBoard:open()
   oClipBoard:setBuffer(cText,XBPCLPBRD_TEXT)
   if oClipBoard:getBuffer(XBPCLPBRD_TEXT) == cText
      lOk:=.t.
   endif
   oClipBoard:close()
   oClipBoard:destroy()
   my_alert("Text "+iif(lOk,"","cannot be ")+"copied to clipboard"+iif(lOk," Ok",""))
The Get_Report_As_Text() does return lines of text with carriage return + linefeed line endings (I checked that).

But when I run it and after the alert appears I go to my Notepad window and paste and instead of the text I was expecting I get some bit of code I copied earlier in the day.

Can anyone see anything wrong? Or am I wrong in assuming that the Xbase++ clipboard can be used by other Windows programs?
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Using clipboard to copy text to Notepad

#2 Post by rdonnay »

I got it to work only after calling oClipboard:clear() after oClipBoard:open()
The eXpress train is coming - and it has more cars.

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: Using clipboard to copy text to Notepad

#3 Post by reganc »

rdonnay wrote:I got it to work only after calling oClipboard:clear() after oClipBoard:open()
You the man! Thanks, Roger, works perfectly.

I wonder if Alaska acknowledged this as a problem? If so, I can't see any mention of it...
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

Post Reply