MenuHandler EditPaste won't fire with Ctrl+V

I’ve created a subclass of a TextField and want to control what people can paste into it.

Some googling told me about the MenuHandler called EditPaste and I’ve written it but when I paste something into my textfield subclass with Ctrl+V it doesn’t execute the code inside. Nor does it work when I right click and click Paste. It will only work when I go Edit->Paste

Is there a better way?

What is the name of the Edit->Paste MenuItem ?

It is not EditPaste or it would work.

Try to add a new MenuHandler and choose its name from the Popup menu (on the right)
If the PopupMenu is empty, then set a MenuBar to the window you are working on.

Ask if the above is not clear.

Thanks for the reply Emile.

I don’t know what I changed, but now Ctrl+V works. However, right click and paste still does not trigger the MenuHandler.

I added it by doing the following:

  1. Right clicking on my subclass
  2. Add to “MyTextField” -> Menu Handler
  3. Named it “EditPaste”

It will now work from Edit->Paste in the Window menu, but right clicking and selecting Paste will not cause it to trigger.

  1. Add to “MyTextField” -> Menu Handler
    In teh Menu Editor, you have a Menu called Edit and a MenuItem named Paste (in fact: EditPaste) ?

If you prefer: can you elaborate how you "named it EditPaste ?
With the keyboard or selecting it in the PopupMenu ?

[I cannot run Xojo right now to check this myself, and memory is … bad. Fortunately, my fingers knows what to type to achive my purposes ;-:)]

Thanks Emile. I managed to just use a check in the TextChange event that filters it out, but unfortunately doesn’t stop it from getting in there in the first place.