Copy/paste issue just under Windows

I filed a bug report but nobody cares. Has anyone an idea?

Here my issue withe copy/paste:
https://tracker.xojo.com/xojoinc/xojo/-/issues/75240

Found this old report, maybe they are connected?

Thanks for helping to solve this mystery…

First of all, it is only one week, there are hundreds of other issues filed month or years ago…

But even if the time was not relevant, your issue only says; My app does something weird, Guess what I did to make it happen?? Not only is just a guess game, you are telling that the problem is something that you do in YOUR app, issues is for bugs in xojo

Other than registering the Ctrl+C and Ctrl+V, you need to strip code and components until you can isolate what causes the issue in your app

I care! I looked at tracker entry, but do you have a simple description? E.g., are you copying from a XOJO app field and then trying to paste into a non-XOJO app and having issues with the data that was on the clipboard?

Xojo staff is on vacation until the 8th.

By the way: Xojo did care, even in the christmas week. Robin asked for a stripped down sample project showing the issue. You said: Look for yourself and download the compiled app from your website. How should this help isolate the issue?

Guess in the dark: Did you register global hotkeys with MBS-Plugins?

Cool, you guys care! I was not aware that a strapped down version in contrast to a normal version would make any difference, nor that they all are on vacation (most people are not).
It would have help me already if someone would have confirmed this weird behaviour of my app (or windows), especially since there was someone who had something similar as I indicated.
Anyway, I look at your suggestions. Thanks.

Make sure you’re doing a Cliboard.Close on Windows as soon as you do not need the Clipboard Object anymore, or it may block the System Clipboard for other Apps.

In short, Create the Clipboard Object, do your thing with it and always Close it right away. :slight_smile:

2 Likes

Hi Sascha

Thanks! After consulting the documentation, I found this:

“On macOS, if you need to change the Text in the Clipboard after you have set it, you should create a new Clipboard object first.”

I create a new clipboard only once, at the beginning of the program, so not to use that command dozends of times… This might not be the problem.

“Closes the Clipboard which enables other Clipboard objects or other programs to access the Clipboard’s data. This function only affects Windows and is automatically called by the Clipboard’s Destructor.”

This could be the culprit, which I as a Mac user never experienced. So I could place a clipboard.close command in the app.deactivate method (and the new clipboard command in the app.activate). I’ll test it once back from my skiing vacation when I can access a Windows PC earliest.

I would not recommend this approach. It will most probably lead to your described issues.
I did the same in the past and also had such issues once my App started being used on Windows also.

Since then, i use Methods in a Module which extend Classes like Strings, Pictures and so on with a CopyToClipboard or RetrieveFromClipboard Function. In those Methods i always create a new Clipboard Object.

Two Examples for such Extensions:

Public Sub CopyToClipboard(Extends s As String)
  Dim c As New Clipboard
    c.Text = s
    c.Close
End Sub
Public Sub RetrieveFromClipboard(Extends s As String)
  Dim c As New Clipboard  
  If c.TextAvailable Then    
    s = c.Text
  End If
  c.Close
End Sub
3 Likes