Skip to content
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

Updating the model of a ComboBox does not change the currently displayed text #5214

Closed
kyp44 opened this issue May 9, 2024 · 1 comment · Fixed by #5217
Closed

Updating the model of a ComboBox does not change the currently displayed text #5214

kyp44 opened this issue May 9, 2024 · 1 comment · Fixed by #5217
Labels
a:widgets Implementation of widgets (from std-widgets.slint) and their styles (mF,bS) bug Something isn't working

Comments

@kyp44
Copy link

kyp44 commented May 9, 2024

Changing the model, i.e. the list of options, in a ComboBox does not also change affect the current-index or the current-value. Here is an demonstration of the issue in SlintPad.

In particular, the text in the box still shows the selected value from the previous model. Clicking the box and selecting one of the new items will fix the issue. Closing the selection box without making a new selection results in the text from the old model still being displayed.

It is possible that this is the intended behavior, but it seems to me that changing the model should also do the following:

  1. Set the current-value to the text of first item in the new model so it at least is consistent with the new model.
  2. Set the current-index either to 0 (the first new item) or -1 (no item selected).

For what it's worth, I am using Rust in both Windows and Linux, and this issue occurs on all platforms (including SlintPad). For now I have a workaround that performs the above steps, but it is a bit hacky and manual, but will made easier and more automatic once this feature is fully implemented and released.

@FloVanGH FloVanGH added a:widgets Implementation of widgets (from std-widgets.slint) and their styles (mF,bS) bug Something isn't working labels May 10, 2024
@FloVanGH
Copy link
Member

Hi and thank you for your report. This is definitively a bug and should work out of the box. We should now able to fix it with #5159.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:widgets Implementation of widgets (from std-widgets.slint) and their styles (mF,bS) bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants