[Q] IMKit: IMKInputController and its menu handler
[Q] IMKit: IMKInputController and its menu handler
- Subject: [Q] IMKit: IMKInputController and its menu handler
- From: JongAm Park <email@hidden>
- Date: Sun, 22 Jun 2008 00:27:04 -0700
Hello, all.
I figured out why it was not possible to handle the menu item for an
input method
According to Apple's own document...
------------------------------------------------------------------------
doCommandBySelector:commandDictionary:
Passes commands that are not generated as part of the text input
process.
- (void)doCommandBySelector:(SEL)aSelector commandDictionary:
(NSDictionary*)infoDictionary
Discussion
The default implementation checks if the input controller object (that
is, self) responds to the selector. If so, it sends the message
performSelector:withObject: to the input controller class. The object
parameter in that case is the infoDictionary parameter.
This method is called when a user selects a command from the text
input menu. To support this, an input method must provide actions for
each menu item that is placed in the menu. For example,
(void)menuAction:(i
------------------------------------------------------------------------
So, even though menu items are hooked up to other controller class
than the IMKInputController, the menu event is still sent to the
IMKInputController, instead of the controller which is hooked up.
Then if I remove the controller class I made, and hope that the menu
items would be handled automatically once I define them in the
IMKInputController, it is wrong. The menu items are not activated. So,
I had to instantiate my subclass of IMKInputController in the NIB and
hooked the menu items to the action handlers defined in the subclass.
It would be much nicer if the menu items are hooked up to any object
in which their handlers are defined, as it was used to be for other
kinds of classes, or if the IB gives a warning message if you are
trying to connect menu items to objects other than the subclass of the
IMKInputController.
Hope this helps other people who suffers like me......
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden