Text Area Intercept Copy/Paste Events

Hi all, I am coding a simple text editor, and I want to intercept copy and paste events. I tried deleting the menu item for it, but it still works. By the way, I am using a normal TextArea. If I could make it so that you can only copy and paste within the TextArea, that would also be great.

Thanks in advance!

Create an EditCopy and EditPaste Menu handlers for the screen on which your textArea resides and put any code you like in there, including just returning true to disallow the actions.

Ok, I got that handled, but how do I set a property to the value of the copied text? (like a clipboard)

clipboard = EditCopy.CopiedText Return True

Is there some sort of function like that?

You want to copy text to the clipboard? Xojo does that for you. In that case don’t create a menu handler, just let Xojo do it. Or am I still confused about what you want to do.

[code]Dim MyStr As String
Dim Clip As Clipboard

If Clip.TextAvailable Then
MyStr = Clip.Text
End If[/code]

??

Or

MyStr = TextArea1.Text
Or…

[quote=59819:@Roger Clary]Create an EditCopy and EditPaste Menu handlers for the screen on which your textArea resides and put any code you like in there, including just returning true to disallow the actions.

[/quote]
If you want to handle the copy/paste menu yourself, you’ll need to subclass the textarea and add menuhandlers to the subclass. Otherwise a window’s handler is only fired if the built-in handler fails… ie no text was selected to copy.