blockly > Block > setWarningText
Block.setWarningText() method
Set this block's warning text.
Signature:
setWarningText(_text: string | null, _opt_id?: string): void;
Parameters
Parameter |
Type |
Description |
_text |
string | null |
The text, or null to delete. |
_opt_id |
string |
(Optional) An optional ID for the warning text to be able to maintain multiple warnings. |
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.
[null,null,["Last updated 2024-09-18 UTC."],[[["The `Block.setWarningText()` method allows you to set or remove warning text associated with a specific block."],["It accepts the warning text as a string (or null to remove it) and an optional ID to manage multiple warnings on the same block."],["Calling this method with text will display a warning icon on the block, providing users with additional information or guidance."]]],["The `Block.setWarningText()` method sets a block's warning text. It accepts two parameters: `_text`, which is the warning text (or `null` to delete it), and an optional `_opt_id` for managing multiple warnings. The method returns void. Its primary action is to either set or remove a specific warning message associated with a block, allowing for potentially multiple distinct warning texts.\n"]]