Page 1 of 1

[Done] SetClipboardText

Posted: Sun May 25, 2025 9:39 am
by #NULL

Code: Select all

SetClipboardText("abc123")
Doesn't seem to work here.
PureBasic 6.21 Beta 4 (Linux - x64)
Ubuntu 24.04.2 LTS

I run this code, then open a new tab in the IDE and repeatedly press ctrl+v. Nothing is pasted the first couple of times and after a while what is pasted is what was in the clipboard before I ran the code, but never what SetClipboardText() was supposed to put there. Not sure if the KDE Plasma clipboard manager is messing with it. Can anybody reproduce this? The clipboard docs don't state what library is used.

Re: SetClipboardText

Posted: Sun May 25, 2025 9:43 am
by #NULL
If i run xclipboard first and then run the code, then xclipboard as well as KDE clipboard manager shows the correct string.

Re: SetClipboardText

Posted: Sun May 25, 2025 11:18 am
by mk-soft
With Mint Linux LMDE 6 the clipboard works with the short code.

I have tested it with Ubuntu 22.04 and 24.04
The application must run here

Code: Select all

If OpenWindow(0, 0, 0, 300, 160, "Test")
  SetClipboardText("Hello")
  Repeat
    Select WaitWindowEvent()
      Case #PB_Event_CloseWindow
        Break
    EndSelect
  ForEver
EndIf

Re: SetClipboardText

Posted: Sun May 25, 2025 4:29 pm
by #NULL
That works here too. But if i kill or close the app, the clipboard is still set correctly. PB probably uses gtk functions for clipboard, so maybe event processing is necessary to make it work. If that's the case, the clipboard library doc should mention that.

Re: [Done] SetClipboardText

Posted: Fri Aug 01, 2025 10:24 am
by Fred
Fixed.