Cut, Copy and Paste from Editorgadget

Windows specific forum
PB&J Lover
Enthusiast
Enthusiast
Posts: 212
Joined: Fri Apr 22, 2005 2:07 pm
Location: U.S.A.
Contact:

Cut, Copy and Paste from Editorgadget

Post 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
-- DB

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction.

Albert Einstein
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
PB&J Lover
Enthusiast
Enthusiast
Posts: 212
Joined: Fri Apr 22, 2005 2:07 pm
Location: U.S.A.
Contact:

Post by PB&J Lover »

How do I point to my string (ptrString)? :?
-- DB

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction.

Albert Einstein
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
PB&J Lover
Enthusiast
Enthusiast
Posts: 212
Joined: Fri Apr 22, 2005 2:07 pm
Location: U.S.A.
Contact:

delete

Post 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
-- DB

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction.

Albert Einstein
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

PB&J Lover wrote:How do I point to my string (ptrString)? :?
Either @stringvariable
or just stringvariable
Post Reply