EditorGadget() clears the clipboard when the program ends

Just starting out? Need help? Post your questions and find answers here.
User avatar
RalfP
New User
New User
Posts: 4
Joined: Wed Apr 23, 2025 12:19 pm
Location: Northern Germany

EditorGadget() clears the clipboard when the program ends

Post 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
User avatar
NicTheQuick
Addict
Addict
Posts: 1504
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

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

Post by NicTheQuick »

This seems not to happen on Linux. The clipboard content is still there after closing the window.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
NicTheQuick
Addict
Addict
Posts: 1504
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

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

Post 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.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post by Fred »

Seems to work as expected here, can anybody else confirm ?
miso
Enthusiast
Enthusiast
Posts: 410
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

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

Post by miso »

Tested and works on win7 64 PB621.beta8 X64, it keeps the content of the clipboard.
User avatar
Kiffi
Addict
Addict
Posts: 1486
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

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

Post by Kiffi »

No problem here (Mac Mini M4 Sequoia, PB6.21 B7 + B8)
Hygge
breeze4me
Enthusiast
Enthusiast
Posts: 633
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

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

Post 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.
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

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

Post by Marc56us »

Windows 10 x64 with Windows clipboard : Same a RalfP and only with Notepad
breeze4me +1
miso
Enthusiast
Enthusiast
Posts: 410
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

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

Post by miso »

Yes, I don't have notepad on this machine, so I tested this clipboard thing with the PB IDE.
Quin
Addict
Addict
Posts: 1131
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

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

Post by Quin »

Works fine on Windows 10 21H2, PB 6.21 b8.
Joubarbe
Enthusiast
Enthusiast
Posts: 703
Joined: Wed Sep 18, 2013 11:54 am
Location: France

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

Post by Joubarbe »

No problem for me. Windows 11, PB 6.20.
User avatar
Piero
Addict
Addict
Posts: 870
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

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

Post by Piero »

W11 ARM VM: copy (PB) and paste (NP) do not work with right-click

(if not copying from EditorGadget no problems)
User avatar
mk-soft
Always Here
Always Here
Posts: 6209
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

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

Post 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.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

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

Post by Little John »

No problems here.
Tested with PB 6.20 and PB 6.21 beta 7 on Windows 11 Pro 24H2.
Last edited by Little John on Mon May 05, 2025 7:56 pm, edited 1 time in total.
Quin
Addict
Addict
Posts: 1131
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

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

Post 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:
Post Reply