Page 1 of 2

EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 1:39 pm
by RalfP
Hello

For me the clipboard is always deleted when the program ends if the program has an EditorGadget().
I haven't found anything about it here.

Here is a test program:

Code: Select all

OpenWindow(0, 0, 0, 500, 100, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
EditorGadget(1, 10, 10, 480, 80)      ; does not keep the text in the clipboard
;StringGadget(1, 10, 10, 480, 80, "") ; keeps the text in the clipboard

SetGadgetText(1, "blabla")

Repeat
Until WaitWindowEvent(20) = #PB_Event_CloseWindow

Define xxx$ = GetClipboardText()
;SetClipboardText(xxx$) ; This is the solution to keep the text in the clipboard after the program ends.

Debug GetClipboardText() ; The text is still in the clipboard.
End

1. Start the test program
2. Copy the text to the clipboard using Control+C
3. Start Notepad
4. Paste the text into Notepad using Control+V (works)
5. Close the test program
6. Paste the text into Notepad again using Control+V (nothing)

It occurs in the IDE and in the EXE.

Can anybody confirm this ?

My configuration:
PB-Version: PureBasic 6.21 Beta 7 (Windows - x64)
OS: Windows 8.1 64 Bit

Greetings
Ralf

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 1:53 pm
by NicTheQuick
This seems not to happen on Linux. The clipboard content is still there after closing the window.

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 1:54 pm
by NicTheQuick
RalfP wrote: Mon May 05, 2025 1:39 pmOS: Windows 8.1 64 Bit
Please upgrade your Windows. Windows 8.1 is no longer supported since 2023.

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 1:55 pm
by Fred
Seems to work as expected here, can anybody else confirm ?

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 2:13 pm
by miso
Tested and works on win7 64 PB621.beta8 X64, it keeps the content of the clipboard.

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 2:21 pm
by Kiffi
No problem here (Mac Mini M4 Sequoia, PB6.21 B7 + B8)

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 2:41 pm
by breeze4me
Windows 10 Korean 22h2 has this issue, too.
After analyzing it, it seems that the format copied from the RichEdit is "DataObject", which Notepad doesn't seem to recognize.
On my PC, I can paste it into PB IDE or other editor programs. But I just can't paste it into Notepad.
I'm not sure about Windows 8.1, so try pasting into other editor programs than Notepad.

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 3:20 pm
by Marc56us
Windows 10 x64 with Windows clipboard : Same a RalfP and only with Notepad
breeze4me +1

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 3:32 pm
by miso
Yes, I don't have notepad on this machine, so I tested this clipboard thing with the PB IDE.

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 3:43 pm
by Quin
Works fine on Windows 10 21H2, PB 6.21 b8.

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 4:11 pm
by Joubarbe
No problem for me. Windows 11, PB 6.20.

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 5:39 pm
by Piero
W11 ARM VM: copy (PB) and paste (NP) do not work with right-click

(if not copying from EditorGadget no problems)

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 6:01 pm
by mk-soft
Window 10 Pro 22H2

Here too, the clipboard is empty when you exit the programme. Assume from Windows internals that it is a copy by ref and only the reference to the editor gadget is in the clipboard.

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 7:47 pm
by Little John
No problems here.
Tested with PB 6.20 and PB 6.21 beta 7 on Windows 11 Pro 24H2.

Re: EditorGadget() clears the clipboard when the program ends

Posted: Mon May 05, 2025 7:56 pm
by Quin
NicTheQuick wrote: Mon May 05, 2025 1:54 pm
RalfP wrote: Mon May 05, 2025 1:39 pmOS: Windows 8.1 64 Bit
Please upgrade your Windows. Windows 8.1 is no longer supported since 2023.
According to Microsoft, sure. Not according to Fred and PureBasic :wink: