开发者

Changing default help key behavior

I have a subclass of a NSWindowController. In my subclass, I have a keyDown: method.

When I press the Help Key on the keyboard, my keyDown: method is n开发者_JAVA百科ot called and I would like it to be as I need to do something custom.

Right now, when I press the help key, the cursor changes to a question mark.

Anyone know how to override the default behavior of the help key?


This is a broken holdover from NextStep.

I filed a bug report about this in June 2006. It was closed as “Behaves correctly”, pointing out that this was a “context-sensetive help mode”, with the note that Apple keyboards no longer have Help keys.

I objected on the basis that there is no documentation of this for either users or developers and the help mode thus never under any circumstances provides actual help. It was then reclassified as a duplicate of bug #3776278. Last I checked (radarweb is currently down) this hadn’t changed.

I suggest filing a duplicate bug report on general principle, but don’t put too much effort in it since it will be ignored.


The best solution I've been able to find is to use the NSContextHelpModeDidActivateNotification to detect when this mode is entered.

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(helpContextModeActivated:)
                                             name:NSContextHelpModeDidActivateNotification
                                           object:nil];

When the selector is called, simply call:

[NSHelpManager setContextHelpModeActive:NO];

to deactivate the mode and change the cursor back.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜