-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Wrong Documentation on Signal item_selected from OptionButton #36803
Comments
Yes, I can confirm that "id" should be changed to "index" in However, while testing, I encountered really weird behavior. Code: func on_option_changed(idx):
print('item changed')
print(idx)
print($Option.get_selected_id())
print($Option.get_item_id(idx))
print($Option.get_item_index($Option.get_item_id(idx))) Output:
Seems that the index in the item list editor does not match up with the index at runtime. The item with an ID of 20 has an index of 2 in the editor, but when selected, it has an index of 1. I'm also unable to reselect "Item 0" with an ID of 0. |
Submitted merge request #37303 as a fix for this, although the changes only cover fixing documentation and the ADD_SIGNAL call in code and do not address the editor-runtime index mismatch. |
* item_selected and item_focused docs incorrectly had 'id' as the parameter. Changed to 'index'. * Fix parameter name in ADD_SIGNAL callin code.
…ted-docs Fix OptionButton item_selected docs #36803
* item_selected and item_focused docs incorrectly had 'id' as the parameter. Changed to 'index'. * Fix parameter name in ADD_SIGNAL callin code. (cherry picked from commit a8de034)
Godot version:
3.2.stable
OS/device including version:
Windows 10 18363
Issue description:
On docs show that the signal item_selected from OptionButton has the ID parameter when it actually the Index, that's a small thing but it really confused me at first that passed over 30 min trying to figure out what was wrong (cause I used the id to be the same to index)
Steps to reproduce:
Minimal reproduction project:
Selecting from bottom to top it returns:
Not 30, 20, 10 as expected
The text was updated successfully, but these errors were encountered: