Re: Simple dialog sheet won't work with return key
Re: Simple dialog sheet won't work with return key
- Subject: Re: Simple dialog sheet won't work with return key
- From: Matt Neuburg <email@hidden>
- Date: Tue, 10 Oct 2006 11:57:43 -0700
- Thread-topic: Simple dialog sheet won't work with return key
On Tue, 10 Oct 2006 10:28:40 -0700, Mark Dawson <email@hidden> said:
>I have a simple dialog sheet that won't work--the return key doesn't activate
the OK button, although the button does "throb" when run. It does work when I
directly click on the OK button. I have other dialog sheets that DO work, and I
can't figure out what's different about this one. This is 10.4.8, XCode 2.4, IB
2.
>
>My sheet has 1 NSTextField (title/enabled) 1 editable NSTextField
(editable/enabled), and a cancel + OK (with "Return" set as its value) button.
The OK and cancel buttons are linked to my a "sheetEnd" action (which isn't
called whe pressing return, but is on a mouse click). I've linked the text
field with an action, and that isn't triggered until I select OK with my mouse
(return doesn't send an "end editing call"). The text field has first responder
status (and the cursor does , correctly, show up in that field when the window
opens). I've removed first responder and delegate (to my window controller)
without any change in behavior. All my sheets are "Windows" (not NSPanels).
All have the same attributes set (no close, minimize, or zoom). When looking at
the view hierarchy, the OK button is the first entry (for all sheet windows)
>
>Any ideas as to what I could be doing wrong?
My first thought was to wonder: Could the trouble be simply that the focus
is in a text field? Cocoa has never been very good at understanding that
when you hit Return in a text field, you don't merely want to "set" the
text, you also want to click the default button if there is one. I always
catch the Return in the NSTextField's delegate's
control:textView:doCommandBySelector: and deal with it myself.
However, then I also see that you say: 'return [in this text field] doesn't
send an "end editing call"'. That is very bizarre, since Return *is* an
NSTextField's action. So if I were you I'd concentrate on trying to
understand why that is. Have you interfered with the message-sending setup
in some other way? (It can also make a difference whether you set the action
to be sent on Enter Only or End Editing in IB.)
m.
PS Why are your sheets NSWindows and not NSPanels? That seems just plain
wrong (though I could be mistaken, of course).
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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