Re: Getting first responder state for a custom view enclosed in a NSTabView ?
Re: Getting first responder state for a custom view enclosed in a NSTabView ?
- Subject: Re: Getting first responder state for a custom view enclosed in a NSTabView ?
- From: Michael Clark <email@hidden>
- Date: Thu, 25 Aug 2005 16:07:53 -0400
Hi.
Is the subview a custom view?
I think this sounds normal.
Michael.
On 25-Aug-05, at 8:30 AM, Martin Wilz wrote:
Hi Michael,
thanks for asking. No my custom view became not first responder, when
clicked. Sorry, my posting
was not entirely clear about that fact.
As it turned out, there was a subview within the custom view, that
"swallowed" the calls to
acceptsFirstResponder, even though it did not implement/subclass
mouseDown or other
responder chain related functions.
From my understanding of the responder chain concepts this should not
have been a problem,
so I did not include this in my problem description, but it turned out
to be one:
The default behaviour after a click to the window is (according to my
half-knowledge) to travel
from the lowest subview in the view hierachy to the window and ask
each of and the superview
(the documentations says succesors), if it wants to become first
responder. This obviously was
not the case with my view hierachy, so for now, I now assume only the
lowest view is asked.
with Regards,
Martin
On 25/08/05, Michael Clark <email@hidden> wrote:
Hi.
If you click on your view with the mouse, does it then become first
responder?
From what I remember, it will, and you should see some logs appear!
If you want this view to be the first responder by default when the
window loads you can set that up in the NIB, or do it
programmatically.
Hope that helps.
Michael.
On 23-Aug-05, at 9:31 AM, Martin Wilz wrote:
Hi,
I'm having trouble getting first responder status in a custom
subclass
of NSView. I'd like to catch key events via -keyDown:. Some
googling
showed, that the view have to aquire first responder status. As I
didn't find any other information on that topic, I assume, that's
all
what it takes. But I'm happy to learn otherwise...
I overrode the following methods, but neither of them gets called
at any time:
- (BOOL)becomeFirstResponder
{
NSLog (@"first responder");
return YES;
}
- (BOOL)acceptsFirstResponder
{
NSLog (@"accepting first responder");
return YES;
}
- (BOOL)resignFirstResponder
{
NSLog (@"first responder no more");
return YES;
}
My current assumption is, this behaviour might have to do with the
NSTabView, where my custom view is added at runtime. Has anyone
encountered similar problem or supects what may be the cause and how
to circumvent it ?
For further diagnosis:
I overrode NSWindows becomeKeyWindow for debugging output. It
reports,
that the first responder is alway the window itself...
Thanks in advance,
Martin
_______________________________________________
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