Page 1 of 1

Cut, Copy and Paste from Editorgadget

Posted: Wed Sep 28, 2005 3:36 pm
by PB&J Lover
Hello All,

I need to cut copy and paste in my editor gadget by using the standard toolbar icons buttons. I know it involves sending messages to the editorgadget, but can anyone tell me how?

Any help is very much appreciated. Viva la PB! :D

Posted: Wed Sep 28, 2005 8:52 pm
by Trond
You mean to affect the current selection when cutting and pasting?

*UNTESTED CODE FOLLOWS*

Paste:

Code: Select all

SendMessage_(hWnd, #EM_REPLACESEL, 1, ptrToString)
Copy:

Code: Select all

SendMessage_(hWnd, #EM_GETSELTEXT, 0, ptrToBuffer)
SetClipboardTextSomehowIDontKnowHow(ptrToBuffer)
Cut: First copy, then paste an empty string.

Posted: Wed Sep 28, 2005 9:42 pm
by PB&J Lover
How do I point to my string (ptrString)? :?

Posted: Wed Sep 28, 2005 9:59 pm
by ts-soft
Not testet:

Code: Select all

SendMessage_(GadgetID(Gadget),#WM_COPY,#Null,#Null)
SendMessage_(GadgetID(Gadget),#WM_CUT,#Null,#Null)
SendMessage_(GadgetID(Gadget),#WM_PASTE,#Null,#Null)
I hope its usefull

delete

Posted: Wed Sep 28, 2005 10:11 pm
by PB&J Lover
Is it save to use the to delete?

Code: Select all

SendMessage_(GadgetID(#Gadget_Main_report), #EM_REPLACESEL, #True, #Null)
It points to #null for the string. It seems to work, but something tells me it wouldn't if there was a string there.

How do I set the string into memory for the paste? :D

Posted: Wed Sep 28, 2005 10:18 pm
by ts-soft
for delete:

Code: Select all

SendMessage_(GadgetID(#Gadget_Main_report), #WM_CLEAR, #Null, #Null)
>> How do I set the string into memory for the paste?
Copy it

Posted: Thu Sep 29, 2005 2:33 pm
by Trond
PB&J Lover wrote:How do I point to my string (ptrString)? :?
Either @stringvariable
or just stringvariable