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: Read only unicode edit text control?



On 5/27/05 9:24 AM, Jim Correia didst favor us with:

> I hope I missing something obvious here. Is it possible to have a
> read only unicode edit text control which still allows the user to
> select and copy a portion of the contents?
> 
> Setting kControlEditTextLockedTag prevents editing, but also seems to
> prevent selecting and copying.

It's possible, but you have to implement it yourself by installing the
following handlers (this is off the top of my head because I haven't done
this recently):

- A kEventCommandUpdateStatus handler that disables the Paste and Cut
commands.

- A kEventCommandProcess handler that returns noErr in response to
kHICommandPaste and kHICommandCut.

- A kEventTextInputUnicodeForKeyEvent handler that returns noErr for
non-navigation characters (you want to allow arrow keys and the tabs for
navigating).

- The last time I spent any time dealing with this, the standard handler
would send Copy and Paste commands to the control even when the
corresponding menu commands were dimmed, so I also installed a key filter
that blocked any key if the Command key was down. In my testing, the key
filter only got such keystrokes if the corresponding menu item was dimmed.
Otherwise they were handled as kEventCommandProcess events.

Have fun. :-)

Larry

 _______________________________________________
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: 
 >Read only unicode edit text control? (From: Jim Correia <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.