Stay organized with collections
Save and categorize content based on your preferences.
blockly > WorkspaceSvg > highlightBlock
WorkspaceSvg.highlightBlock() method
Highlight or unhighlight a block in the workspace. Block highlighting is often used to visually mark blocks currently being executed.
Signature:
highlightBlock(id: string | null, opt_state?: boolean): void;
Parameters
Parameter |
Type |
Description |
id |
string | null |
ID of block to highlight/unhighlight, or null for no block (used to unhighlight all blocks). |
opt_state |
boolean |
(Optional) If undefined, highlight specified block and automatically unhighlight all others. If true or false, manually highlight/unhighlight the specified block. |
Returns:
void
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\u003ehighlightBlock\u003c/code\u003e method is used to visually distinguish a specific block or unhighlight all blocks within the workspace.\u003c/p\u003e\n"],["\u003cp\u003eIt takes an optional \u003ccode\u003eopt_state\u003c/code\u003e parameter that allows for manual control over highlighting, otherwise it automatically unhighlights other blocks when highlighting a new one.\u003c/p\u003e\n"],["\u003cp\u003eThe primary use case for this method is to visually indicate the block currently being executed.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [WorkspaceSvg](./blockly.workspacesvg_class.md) \\\u003e [highlightBlock](./blockly.workspacesvg_class.highlightblock_1_method.md)\n\nWorkspaceSvg.highlightBlock() method\n------------------------------------\n\nHighlight or unhighlight a block in the workspace. Block highlighting is often used to visually mark blocks currently being executed.\n\n**Signature:** \n\n highlightBlock(id: string | null, opt_state?: boolean): void;\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|-----------|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| id | string \\| null | ID of block to highlight/unhighlight, or null for no block (used to unhighlight all blocks). |\n| opt_state | boolean | *(Optional)* If undefined, highlight specified block and automatically unhighlight all others. If true or false, manually highlight/unhighlight the specified block. |\n\n**Returns:**\n\nvoid"]]