Instance Method インスタンスメソッド

application:delegateHandlesKey:

Sent by Cocoa’s built-in scripting support during execution of get or set script commands to find out if the delegate can handle operations on the specified key-value key.

Declaration 宣言

- (BOOL)application:(NSApplication *)sender 
 delegateHandlesKey:(NSString *)key;

Parameters パラメータ

sender

The app object associated with the delegate.

key

The key to be handled.

Return Value 戻り値

YES if your delegate handles the key or NO if it does not.

Discussion 解説

The method should return YES if the delegate for the app sender handles the key specified by key, which means it can get or set the scriptable property or element that corresponds to that key. The app implements methods for each of the keys that it handles, where the method name matches the key.

For example, a scriptable app that doesn’t use Cocoa’s document-based app architecture can implement this method to supply its own document ordering. Such an app might want to do this because the standard app delegate expects to work with a document-based app. The TextEdit app (whose source is distributed with macOS developer tools) provides the following implementation:


return [key isEqualToString:@"orderedDocuments"];

TextEdit then implements the orderedDocuments method in its controller class to return an ordered list of documents. An app with its own window ordering might add a test for the key orderedWindows so that its delegate can provide its own version of orderedWindows.

See Also 参照

Methods

Related Documentation 関連文書