Re: Temporarily Editable NSTextField
Re: Temporarily Editable NSTextField
- Subject: Re: Temporarily Editable NSTextField
- From: Matt Neuburg <email@hidden>
- Date: Mon, 02 May 2005 15:05:17 -0700
On Mon, 2 May 2005 12:29:43 -0400, Graham <email@hidden> said:
>Hi,
>
>I am creating an NSTextField subclass that is not editable until
>clicked upon and I wish it to return to being non-editable when the
>user presses enter (to accept their edit) or Escape (to cancel their
>edit).
>
>I've successfully achieved this except for canceling the edit when ESC
>key is pressed.
>
>In the textDidEndEditing method I do: setEditable(false),
>setDrawsBackground(false) and setBezeled(false), and in the context of
>this method, those calls all work fine, but that method is only called
>when enter is pressed. So to handle the ESC key I am listening for
>keyUp events and when ESC key is pressed I call those same three
>methods, but in this context they have no effect.
Are you sure? I'm betting that it's working just fine - but the field editor
is in the way so you can't see the NSTextField changing back to a
non-editable appearance. Be sure to tell the field editor to end editing so
you can see the NSTextField. I've written code that toggles all the
NSTextFields in a window between editable and non-editable, in both
directions, and it works just fine. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden