Page 1 of 1
Copy Paste gadget editor
Posted: Mon Aug 21, 2023 6:27 pm
by andrey2023
How to read and write selected text to clipboard? (Copy Paste)
For example in the Editor gadget?
Re: Copy Paste gadget editor
Posted: Mon Aug 21, 2023 6:48 pm
by jacdelad
Code: Select all
SetGadgetText(#MyEditor,GetClipboardText())
SetClipboardText(GetGadgetText(#MyEditor))
Re: Copy Paste gadget editor
Posted: Mon Aug 21, 2023 7:03 pm
by andrey2023
need highlighted text
Re: Copy Paste gadget editor
Posted: Mon Aug 21, 2023 9:48 pm
by jacdelad
Sorry, I overhead the "selected".
Windows:
Code: Select all
Define start.l.end.l
Sendmessage_(GadgetID(#MyEditor),#EM_GETSEL,@start,@end)
SetClipboardText(Mid(GetGadgetText(#MyEditor),start+1,end-start))
Typed on my phone, hope it's correct.
Re: Copy Paste gadget editor
Posted: Tue Aug 22, 2023 3:54 pm
by andrey2023
and under linux?
Re: Copy Paste gadget editor
Posted: Tue Aug 22, 2023 4:00 pm
by jacdelad
andrey2023 wrote: Tue Aug 22, 2023 3:54 pm
and under linux?
Under Linux you need a different approach.

Re: Copy Paste gadget editor
Posted: Tue Aug 22, 2023 6:31 pm
by Sicro
andrey2023 wrote: Tue Aug 22, 2023 3:54 pm
and under linux?
It is always an advantage to specify in your initial question for which operating system you are looking for a solution.
Here is a sample code for Linux:
http://www.chabba.de/Linux/EditorGadget ... Command.pb
- Select text in the EditorGadget and press the left button at the top to copy the selected text to the clipboard.
- Select text in the EditorGadget and press the middle button at the top to cut out the selected text and copy it to the clipboard.
- Place the text cursor anywhere in the text of the EditorGadget and press the top right button to paste the text from the clipboard to the position of the text cursor.