Clipboard not overwriting non-Xojo Copied text

If I have copied text from another application and then have Xojo copy new text, the subsequent paste of the clipboard outside of Xojo pastes the original non Xojo text.
For example:
Copy "ranger’ from my email.
Move to Xojo and execute:

Var c As New Clipboard
c.Text = “Bill”
c.Close

Move back to email and it Pastes “ranger”, not “Bill”
How do I overwrite the non-Xojo clipboard?
(OSX Sequoia 15.5 ; Xojo Version 2025 Release 1)

Sorry, not using Sequoia, but I can’t reproduce with:

  • macOS 13.7.5
  • macOS 14.7.6
  • Xojo 2025r1.1

This works as expected for me.

Sequoia 15.5, Xojo 2025r1.1

There’s a known quirk on Windows where sometimes you have to clear the clipboard first with declares. I do not know off the top of my head what the pattern is or why it occurs. Would be bad if this is spreading to Mac too :grimacing:

I got something like that when in low available memory.

Quit all applications, shut down, reboot and all is OK. (if you do not run too many applications before testing).

Tried in OSX 15.5 and can’t reproduce the issue either. Also, I’ve never encountered this behaviour.
Possibly your email client stores additional flavours of data in the clipboard, that are retained when only plain text is set later… Which email client do you use? And did you copy text from a mail you were typing (rather than viewing one)?

This has only happened to me once so far. In a project where I had accessed the clipboard at various points and at one point forgot to use Clipboard.Close.
After forgetting to close the clipboard, subsequent access to the clipboard wouldn’t work properly. It even got to the point where other apps started having problems accessing the clipboard.

2 Likes

Thank you all for your testing and comments. The problem was intermittent for me as well. I have corrected a few places in the program where I did not Close the clipboard appropriately, but I had not executed those portions when the error occurred - but better to correct it then wait for it to happen!

I think I will go with the low memory issue as the solution. I did restart the Mac and checked the point of the error and did not find it. If I see it again, I will check overall memory availability to verify.

Thanks everyone - this is an amazing support group to get so many eyes on a problem so quickly

3 Likes