お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、Earth Engine へのアクセスを維持するために
非商用目的での利用資格を確認する必要があります。
ui.root.setKeyHandler
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
事前定義されていないキーを使用して、keydown イベント ハンドラをルートパネルに設定します。ハンドラは、ユーザーがバインドされたキーコマンドを押したときに 1 回だけ起動されます。同じキーは、設定された最新のハンドラ セットにバインドされます。
用途 | 戻り値 |
---|
ui.root.setKeyHandler(keyCode, handler, description) | |
引数 | タイプ | 詳細 |
---|
keyCode | List<ui.Key>|ui.Key | キーコードまたはキーコードの配列。たとえば、ui.Key.A や [ui.Key.SHIFT, ui.Key.A] などです。 |
handler | 関数 | キーコマンドのハンドラ。 |
description | 文字列、省略可 | このキーコマンドの説明。説明はショートカット メニューに表示されます。 |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[null,null,["最終更新日 2025-07-26 UTC。"],[[["\u003cp\u003e\u003ccode\u003esetKeyHandler\u003c/code\u003e enables assigning custom keyboard shortcuts to the root panel within a Google Workspace Add-on.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts a key code (or array for combinations), a handler function to execute, and an optional description for the UI.\u003c/p\u003e\n"],["\u003cp\u003eOnly the most recently assigned handler for a specific key combination will be active, replacing any previous ones.\u003c/p\u003e\n"],["\u003cp\u003eThese custom shortcuts can be accessed and viewed by users within the add-on's Shortcuts Menu when a description is provided.\u003c/p\u003e\n"]]],["The `setKeyHandler` function binds a key command to a handler function on the root panel. It accepts a key code (or array of codes), a handler function, and an optional description. When the bound key is pressed, the handler is executed once. Only the most recently assigned handler for a specific key will be triggered. Key codes can be individual (e.g., `ui.Key.A`) or combined (e.g., `[ui.Key.SHIFT, ui.Key.A]`). The description is used in the Shortcuts Menu.\n"],null,["# ui.root.setKeyHandler\n\n\u003cbr /\u003e\n\nSets a keydown event handler to the root panel with a non-predefined key. The handler is fired only once when a user presses the bound key command. The same key will be bound to the latest handler set to it.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|------------------------------------------------------------|---------|\n| `ui.root.setKeyHandler(keyCode, handler, `*description*`)` | |\n\n| Argument | Type | Details |\n|---------------|------------------------|------------------------------------------------------------------------------------------------------------|\n| `keyCode` | List\\\u003cui.Key\\\u003e\\|ui.Key | A key code or an array of key codes. For example, ui.Key.A or \\[ui.Key.SHIFT, ui.Key.A\\]. |\n| `handler` | Function | The handler for the key command. |\n| `description` | String, optional | A short description that explains this key command. The description will be visible in the Shortcuts Menu. |"]]