ui.root.setKeyHandler
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
यह कुकी, रूट पैनल में keydown इवेंट हैंडलर सेट करती है. इसके लिए, पहले से तय नहीं की गई कुंजी का इस्तेमाल किया जाता है. जब कोई उपयोगकर्ता बाउंड की कमांड दबाता है, तब हैंडलर सिर्फ़ एक बार ट्रिगर होता है. यह कुंजी, उस हैंडलर से जुड़ी होगी जिसे हाल ही में सेट किया गया है.
इस्तेमाल | रिटर्न |
---|
ui.root.setKeyHandler(keyCode, handler, description) | |
आर्ग्यूमेंट | टाइप | विवरण |
---|
keyCode | List<ui.Key>|ui.Key | कुंजी कोड या कुंजी कोड की एक सरणी. उदाहरण के लिए, ui.Key.A या [ui.Key.SHIFT, ui.Key.A]. |
handler | फ़ंक्शन | कुंजी कमांड के लिए हैंडलर. |
description | स्ट्रिंग, ज़रूरी नहीं | कम शब्दों में इस कुंजी के काम के बारे में जानकारी. ब्यौरा, शॉर्टकट मेन्यू में दिखेगा. |
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 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. |"]]