On Apr 30, 2008, at 5:55 AM, Sam Mauney wrote:
I am currently calling a function where kHICommandPaste is tripped that uses Pasteboard
functions so I can filter the pasted contents into an edit control.
I am having trouble overrriding or suppressing the normal paste. So if I paste in the digit "2"
the result in the edit control will be "22".
What is the best way to override the normal paste so I can prevent this from happening?
Look into the Carbon events
{kEventClassTextInput, kEventTextInputUnicodeForKeyEvent}
for pre-10.4, or
{kEventClassTextField, kEventTextShouldChangeInRange}
for 10.4 and later. If you install these on the edit control that you want to filter, you can control which characters are accepted by the control. It's a better solution than overriding paste in general.
steve