-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
On GTK, OptionContainer current_tab returns wrong index #2703
Comments
I can't reproduce this with the Toga main branch on Cocoa, so I assume it's specific to GTK. But I can't currently run Toga on GTK because my Linux distribution is too old. @freakboy3742: Can you reproduce it on GTK? |
Yes, it seems to be a GTK specific issue, on Windows the OptionContainer works correct. |
You said it happens with examples/optioncontainer, which does create a MainWindow. |
I'm using toga 0.4.5 so I adapted the example using only the Window-class instead of MainWindow.
Maybe I need to change pyproject.toml. |
Toga 0.4.5 is the current stable version, which requires every app to have a MainWindow. We've removed this restriction on the main branch. To use it, edit your pyproject.toml file to replace the
And similarly for the other I think it's unlikely that the window type will make any difference to the OptionContainer behavior, but it would be easy enough for you to check. |
I checked the example with the code of the main branch and the problem still remains. So you are right: the OptionContainer behavior does not depend on the window type. |
I can confirm I'm seeing this on GTK with main - the callback appears to be invoked with the "old" index, not the newly selected index. The issue is event timing. When the GTK Unfortunately, there doesn't appear to be a "switch has completed" event - the only event that seems to do anything in response to a tab change is "switch-page". One workaround is to defer the firing of the on_select event; if that event is put onto the event loop, rather than firing immediately, the "switch-page" event completes, and Another workaround would be to avoid |
Describe the bug
The property "current_tab" of an OptionContainer-Object returns the wrong index of the current tab.
This happens because the first click on a tab is obviously not registered.
As a consequence the previous index is returned.
Steps to reproduce
Expected behavior
OptionContainer.current_tab.index should return the current index of the clicked tab not the previous index
Screenshots
No response
Environment
Logs
Additional context
No response
The text was updated successfully, but these errors were encountered: