blockly > FieldVariable > onItemSelected_
FieldVariable.onItemSelected_() method
Handle the selection of an item in the variable dropdown menu. Special case the 'Rename variable...' and 'Delete variable...' options. In the rename case, prompt the user for a new name.
Signature:
protected onItemSelected_(menu: Menu, menuItem: MenuItem): void;
Parameters
Parameter |
Type |
Description |
menu |
Menu |
The Menu component clicked. |
menuItem |
MenuItem |
The MenuItem selected within menu. |
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 `onItemSelected_` method manages actions when an item is selected from the variable dropdown within a Blockly block."],["It handles special cases like renaming or deleting a variable, prompting for a new name when renaming."],["This method is called with the clicked menu and the selected menu item as input."]]],[]]