Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

keyboard loop oddities

0 views
Skip to first unread message

silverdr

unread,
May 21, 2007, 8:19:19 AM5/21/07
to
Hello,

I have encountered a strange (to me) problem with keyboard loop. I have
several buttons placed as subviews of two NSBox-es, which are in turn
located on a NSView. I set the keyboard loop properly (multiple times
checked) in IB but whenever I reach the last button in one NSBox,
instead of jumping to the first button in the second box I get the message:

*** -[NSBox refusesFirstResponder]: selector not recognized [self =
0x35ed30]

Sure NSBox shouldn't become the FirstResponder! In fact, it shouldn't
even be touched as nextKeyView is set in IB to be the next button and
NOT the NSBox...

I use the following custom code to switch between the buttons:

- (BOOL)nextControl
{
NSControl *aControl = self;

while (([(NSControl *)[aControl nextKeyView] refusesFirstResponder]) ||
([(NSControl *)[aControl nextKeyView] isEnabled] == NO))
{
aControl = (NSControl *)[aControl nextKeyView];
if (aControl == self)
return FALSE;
}

return [[self window] makeFirstResponder:(NSControl *)[aControl
nextKeyView]];
}

I use the custom code because I want it to work regardless of the
CTRL-F7 settings. The funny thing is that it already worked until I
started placing the controls on top of different views and seemingly
spoiled something ;-) Does anyone have a guess (or knowledge!) what is
wrong here?

silverdr

unread,
May 22, 2007, 7:33:57 AM5/22/07
to
silverdr wrote:

> I have encountered a strange (to me) problem with keyboard loop. I have
> several buttons placed as subviews of two NSBox-es, which are in turn
> located on a NSView. I set the keyboard loop properly (multiple times
> checked) in IB but whenever I reach the last button in one NSBox,
> instead of jumping to the first button in the second box I get the message:
>
> *** -[NSBox refusesFirstResponder]: selector not recognized [self =
> 0x35ed30]
>
> Sure NSBox shouldn't become the FirstResponder! In fact, it shouldn't
> even be touched as nextKeyView is set in IB to be the next button and
> NOT the NSBox...
>

> [...] The funny thing is that it already worked until I

> started placing the controls on top of different views and seemingly
> spoiled something ;-) Does anyone have a guess (or knowledge!) what is
> wrong here?

OK. While moving controls to different views I disconnected the window's
"initialFirstResponder" outlet. Reconnecting it with CTRL-drag (menu
function dosn't work here - understandable but a warning wouldn't hurt
IMHO) solved the problem, even if I am not sure why lack of this
connection actually causes it.

0 new messages