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

Setting current-index on ComboBox does not work in some situations #7632

Open
npwoods opened this issue Feb 13, 2025 · 1 comment
Open

Setting current-index on ComboBox does not work in some situations #7632

npwoods opened this issue Feb 13, 2025 · 1 comment
Labels
a:widgets Implementation of widgets (from std-widgets.slint) and their styles (mF,bS) bug Something isn't working need triaging Issue that the owner of the area still need to triage

Comments

@npwoods
Copy link
Contributor

npwoods commented Feb 13, 2025

Bug Description

bug-demo.zip

In the attached example, main.slint looks like this:

import { ComboBox } from "std-widgets.slint";

export component AppWindow inherits Window {
    in property <[string]> combobox-model;
    in-out property <int> combobox-index <=> my-combobox.current-index;
    my-combobox := ComboBox {
        model: root.combobox-model;
    }
}

src/main.rs:

fn main() {
    let app_window = AppWindow::new().unwrap();

    let items = [
        "not this1",
        "not this2",
        "!!!THIS!!!",
        "not this3",
        "not this4",
    ];
    let model = VecModel::from_iter(items.iter().copied().map(SharedString::from));
    let model = ModelRc::new(model);
    app_window.set_combobox_model(model);
    app_window.set_combobox_index(2);
    app_window.run().unwrap();
}

I would expect this to result in a ComboBox with !!!THIS!!! selected. But it seems to not stick. Curiously, if we don't specify the model and put the ComboBox items directly in main.slint, this works

Reproducible Code (if applicable)

Environment Details

  • Slint Version: 1.9.2
  • Platform/OS: Windows
  • Programming Language: Rust

Product Impact

No response

@npwoods npwoods added bug Something isn't working need triaging Issue that the owner of the area still need to triage labels Feb 13, 2025
npwoods added a commit to npwoods/bletchmame_rs that referenced this issue Feb 13, 2025
…n window will launch the Paths Dialog

Previously these would bring up a file dialog.  This works well for setting the MAME executable, but wasn't really good when setting the Plugins dialog, which requires specifying multiple paths.

Unfortunately when correcting a misconfiguration of the Plugins directory, the Paths Dialog will say "MAME Executable" even if it is showing the Plugins paths.  This seems to be a Slint bug:  slint-ui/slint#7632
@hunger
Copy link
Member

hunger commented Feb 14, 2025

Thank you for reporting your problem.

This might be related to #6619, which is about the ComboBox showing the wrong item. I do not think it is the same issue though.

@hunger hunger added the a:widgets Implementation of widgets (from std-widgets.slint) and their styles (mF,bS) label Feb 14, 2025
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 need triaging Issue that the owner of the area still need to triage
Projects
None yet
Development

No branches or pull requests

2 participants