-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A bucket of issues with OptionButton (Dropdown) #6558
Comments
Here is an OptionButton demo I made that should help you visualize the issues. |
Referencing #3188 since this issue is related to the PopupMenu API which is likely to be refactored for 3.0. That issue does not mention your problems though. |
Is there a reason why |
Testing with a Godot 3-compatible remake of above demo: 6558_Demo2.zip Testing on linux mint 18.3 with Godot 3.2.3.beta1 Deleting selected item does not update selection/text: still true |
Several of these listed issues have been fixed in #57330. It would be good to review the list and see what's left - possibly moving them to dedicated proposals or bug reports. |
I checked all points and they seem to be resolved. |
(Godot build from 20.09.16)
Deleting Items
If you select an item and delete the same item, OptionButton does not change the selected text visible.
If you use the clear() function, selected id turns to -1 and there won't be any text visible; however, if you delete the last item without using clear(), selected item is still 0.
A possible solution, If you are deleting last item is to set selected id to -1
Another possibility would be to add an extra optional bool in remove_item() where false would be to return to the first item (if any) or -1 if it was the last item. True could be to move to the next item in selection (i.e. you delete ID 3, you select the new ID at 3).
Currently, when there are more items; simply deleting selected item will just
Selecting previously deleted ID
Currently when you try to select another item which have the same ID like the deleted item, it wont allow you to select it.
Adding an Item
After deleting the last item (having selected id at 0, problem with deletion), adding a new item does not automatically select the first item.
If you fix the problem with deletion, the selected_id should by default be -1 (when there are no previous item added) - which should automatically set selected to 0 when the first item is added.
(Of course you should not automatically select the LAST item if there are previous items available)
Cannot set selected to none
You are unable to set selected to -1 (none). You can use .select(id) to choose any existing ID, but we should definitely implement the option to set to -1 (none), which also is the same selected id you get when you use .clear().
OptionButton is a misleading name
Godot would benefit from renaming OptionButton to DropdownButton or something similar that gives you the perfect description of what it is. :)
The text was updated successfully, but these errors were encountered: