I want to "lose the links" in a TextArea

I want to be able to copy text from another app (say Safari/Firefox etc) and paste it into a TextArea.
and I want it as PLAIN TEXT… that is I want to LOSE ALL the style information that may have been embedded.

Right now I am doing that by SELECTALL, bold/italic etc=false, color=black, font=courier
which works fine EXCEPT for any Links that may have been in the cut text… they still show up as links… I do not want that.

Also… anyway I can detect that text was PASTED into the TextArea as opposed to typed?

Turn off Styled in the inspector. You will have only plain text in the TextArea.

As for pasted text, it would be so simple to add a menu handler for EditPaste, but it simply would not work :frowning:

Why not store the last len(me.Text) in TextChange. If the len of change is more than one character, chances are it has been pasted.

For paste of one character, store the last key in KeyDown and compare with what has been pasted. If the user has pasted only one character (not frequent), it should not match the last key. Of course, this is not bullet proof, as a user may indeed type ‘a’, then copy it, then paste it. But it is probably statistically rare enough.

Turning STYLED off is not an option, as once the text is entered (user typed or pasted), I will be highlighting certain sections, but my highlighting must over-ride any/all highlighting that came in with the text

Im headed to southern va and I might have service and can forward you a RidHTML formatting function (plus other goodies)… Can remove the blue underlines as well as get plain text from html source. … Might help

This SHOULD would in an EditPaste menu handler, but I can’t get it to fire… seems the OS would rather handle it… ?
Not sure how you could detect a Paste if there’s no way to handle the EditPaste menu… Oh, wait! Change the name of your EditPaste menuItem in menuBar1… then handle it

if self.Focus=TextArea1 then dim c As new Clipboard if c.TextAvailable then TextArea1.SelText=c.text Return True end if end if

Safari does not have the option to copy the URL (as a text address), it copy the URL as URL (so, with style: underlined blue… etc.).

FireFox have the option of copying a link as text…

If the above is not crystal clear, you can right-click a link on FireFox, watch the list of options and do the same in Safari.

You can subclass the EditField and add an menu handler to the subclass.