Stay organized with collections
Save and categorize content based on your preferences.
blockly > Field > onShortcut
Field.onShortcut() method
Handles the given keyboard shortcut.
Signature:
onShortcut(_shortcut: KeyboardShortcut): boolean;
Parameters
Parameter |
Type |
Description |
_shortcut |
KeyboardShortcut |
The shortcut to be handled. |
Returns:
boolean
True if the shortcut has been handled, false otherwise.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eonShortcut\u003c/code\u003e method in Blockly's Field class determines how a field responds to a specific keyboard shortcut.\u003c/p\u003e\n"],["\u003cp\u003eIt takes a \u003ccode\u003eKeyboardShortcut\u003c/code\u003e object as input, representing the triggered shortcut.\u003c/p\u003e\n"],["\u003cp\u003eIf the method successfully processes the shortcut, it returns \u003ccode\u003etrue\u003c/code\u003e; otherwise, it returns \u003ccode\u003efalse\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `onShortcut` method, part of the `Field` class, processes keyboard shortcuts. It accepts a `KeyboardShortcut` as input. The method's core function is to determine if a given shortcut is relevant to a particular field. It returns a boolean value: `true` if the shortcut was handled by the field, and `false` if the shortcut was not handled, implying that other parts of the program can potentially handle it.\n"],null,["[blockly](./blockly.md) \\\u003e [Field](./blockly.field_class.md) \\\u003e [onShortcut](./blockly.field_class.onshortcut_1_method.md)\n\nField.onShortcut() method\n-------------------------\n\nHandles the given keyboard shortcut.\n\n**Signature:** \n\n onShortcut(_shortcut: KeyboardShortcut): boolean;\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|-----------|------------------|-----------------------------|\n| _shortcut | KeyboardShortcut | The shortcut to be handled. |\n\n**Returns:**\n\nboolean\n\nTrue if the shortcut has been handled, false otherwise."]]