Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: overriding paste



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

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >overriding paste (From: "Sam Mauney" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.