Next Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

NSInputServiceProvider

Package
com.apple.cocoa.application
Companion guide

Overview

The NSInputServiceProvider interface embodies most of the functionality of NSInputServer.

There are two ways you might use this interface:

All messages in this interface are sent by the client text view except insertText and doCommandBySelector, which are sent by NSInputManager.

Tasks

Command Instance Methods Sent by Client

Query Instance Methods Sent by Client

Instance Methods Sent by NSInputManager

Instance Methods

activeConversationChanged

Keyboard focus just switched from another text view to this one.

public abstract void activeConversationChanged(Object sender, int newConversation)

Discussion

This is called only when switching within the same application. sender can be cast to NSTextInput.

See Also

activeConversationWillChange

Keyboard focus is about to move away from this text view.

public abstract void activeConversationWillChange(Object sender, int oldConversation)

Discussion

This is called only when switching within the same application. sender can be cast to NSTextInput.

See Also

canBeDisabled

Returns true if the receiver can be disabled when the sender is not a text view, false

public abstract boolean canBeDisabled()

Discussion

otherwise.

doCommandBySelector

Handle the command identified by aSelector.

public abstract void doCommandBySelector(NSSelector aSelector, Object sender)

Discussion

The command can be from the set of NSResponder action methods or from the set of selector values in the DefaultKeyBindings dictionary referenced in the input server’s “Info” file. sender can be cast to NSTextInput.

If you are subclassing NSInputServer, there is no need to override this method in the subclass. All you have to do is implement in the subclass the command methods you want to handle. If you do need to override this method, then you must call super for commands not handled.

If your NSInputServer uses a delegate, the delegate’s implementation of this method must call doCommandBySelector(sender, aSelector) for commands it does not handle.

See Also

inputClientBecomeActive

The client, sender, has become active.

public abstract void inputClientBecomeActive(Object sender)

Discussion

This is called when the client application starts up and whenever it becomes active after being inactive. sender can be cast to NSTextInput.

See Also

inputClientDisabled

A text view in the client, sender, has ceased to be the key-receiving first responder.

public abstract void inputClientDisabled(Object sender)

Discussion

inputClientResignActive may also be called just after this is called. sender can be cast to NSTextInput.

See Also

inputClientEnabled

A text view in the client, sender, has become the key-receiving first responder.

public abstract void inputClientEnabled(Object sender)

Discussion

This is called the first time any text view becomes enabled after client application activation and again whenever focus switches to a text view. inputClientBecomeActive may have been called just before this is called. sender can be cast to NSTextInput.

See Also

inputClientResignActive

The client, sender, is about to become inactive.

public abstract void inputClientResignActive(Object sender)

Discussion

This is called when the client application quits and whenever it is deactivated. sender can be cast to NSTextInput.

See Also

insertText

Interpret the characters in aString, which is actually always a String.

public abstract void insertText(Object aString, Object sender)

Discussion

Here is where you do the interpreting of keyboard input. If your server’s interpretation is disabled or the characters in aString are not of interest to the server, you can simply pass aString along to the sender’s insertText method. sender can be cast to NSTextInput.

See Also

markedTextAbandoned

Abandon any marked text state that may be in process.

public abstract void markedTextAbandoned(Object sender)

Discussion

This can happen if the user clicks the mouse outside of the marked text area or if the window containing the text view closes. The client can do what it wants with the marked text. NSTextView leaves it as inserted text. sender can be cast to NSTextInput.

See Also

markedTextSelectionChanged

public abstract void markedTextSelectionChanged(NSRange newSelection, Object sender)

Discussion

The user selected a portion of the marked text or clicked at the beginning or end of marked text or somewhere in between. sender can be cast to NSTextInput.

See Also

terminate

The client application is quitting.

public abstract void terminate(Object sender)

Discussion

This is called after inputClientResignActive. sender can be cast to NSTextInput.

See Also

wantsToDelayTextChangeNotifications

A true return value tells the client that only a call to its insertText method constitutes a modification to its text storage.

public abstract boolean wantsToDelayTextChangeNotifications()

Discussion

A false return value tells the client that all text given to it, whether marked text or not, should constitute a modification to its text storage. A true return value tells the client that only unmarked text given to it should constitute a modification to its text storage. The client may for example want to filter all text that is part of a modification but leave marked text unfiltered.

See Also

wantsToHandleMouseEvents

Returns true if the client should forward all mouse events within the text view to the input server.

public abstract boolean wantsToHandleMouseEvents()

Discussion

If the server needs to implement the NSInputServerMouseTracker interface, return true.

See Also

wantsToInterpretAllKeystrokes

Returns true if the server wants all keystrokes to be sent to it as characters.

public abstract boolean wantsToInterpretAllKeystrokes()

Discussion

If this method returns false, control key combinations and function keys (the arrow keys, PageDown, F5, and so on) are delivered to the input server via the key binding mechanism and doCommandBySelector.

The Unicode values for the characters representing keyboard function keys (the arrow keys, PageDown, F5, and so on) names like NSEvent.UpArrowFunctionKey, and are documented in NSEvent. Control-key combinations are the usual ASCII control character codes.

For more information on key bindings, see “About Key Bindings”.

See Also


Next Page > Hide TOC


© 1997, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-02-01)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.