Make various improvements to OptionButton

- Allow OptionButton selection to be set to -1 to signify no selection, both via API and in the editor.
- Reset OptionButton selection to -1 when the selected item has been removed.
- Fully convert PopupMenu to a zero-based ID system, which improves an inconsistency in generated IDs when making new items in the editor.
This commit is contained in:
eikobear
2022-01-28 17:03:45 -05:00
parent b9a2569be6
commit 3b146c5eaa
3 changed files with 35 additions and 22 deletions

View File

@ -84,7 +84,7 @@
<method name="get_selected_id" qualifiers="const">
<return type="int" />
<description>
Returns the ID of the selected item, or [code]0[/code] if no item is selected.
Returns the ID of the selected item, or [code]-1[/code] if no item is selected.
</description>
</method>
<method name="get_selected_metadata" qualifiers="const">
@ -112,6 +112,7 @@
<argument index="0" name="idx" type="int" />
<description>
Selects an item by index and makes it the current item. This will work even if the item is disabled.
Passing [code]-1[/code] as the index deselects any currently selected item.
</description>
</method>
<method name="set_item_disabled">