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

Support for multiple windows #1377

Closed
DBLouis opened this issue Jun 28, 2022 · 4 comments
Closed

Support for multiple windows #1377

DBLouis opened this issue Jun 28, 2022 · 4 comments

Comments

@DBLouis
Copy link

DBLouis commented Jun 28, 2022

I could not find a way to instantiate multiple windows. Is this currently not possible?

@tronical
Copy link
Member

It is possible, but it's a little tricky.

Suppose you have MyWindow1 := Window { ... } and MyWindow2 := Window { ... } and want to show them. To overcome #784 you could put say MyWindow2 into a helper crate, build it using build.rs and export it. Then in your main crate you can import MyWindow and then write something like this:

fn main() {
    let my_window_1 = MyWindow1::new();
    let my_window_2 = helper_create::MyWindow2::new();
    my_window_1.show();
    my_window_2.show();
    slint::run_event_loop();
}

I haven't tested this, but this might work as workaround until #784 is resolved.

@ogoffart
Copy link
Member

Closing as the main issue is tracked in #784

@ogoffart ogoffart closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2022
@Davidc2525
Copy link

It is possible, but it's a little tricky.

Suppose you have MyWindow1 := Window { ... } and MyWindow2 := Window { ... } and want to show them. To overcome #784 you could put say MyWindow2 into a helper crate, build it using build.rs and export it. Then in your main crate you can import MyWindow and then write something like this:

fn main() {
    let my_window_1 = MyWindow1::new();
    let my_window_2 = helper_create::MyWindow2::new();
    my_window_1.show();
    my_window_2.show();
    slint::run_event_loop();
}

I haven't tested this, but this might work as workaround until #784 is resolved.

I don't know how to do it, can you leave an example?

@Davidc2525
Copy link

It is possible, but it's a little tricky.

Suppose you have MyWindow1 := Window { ... } and MyWindow2 := Window { ... } and want to show them. To overcome #784 you could put say MyWindow2 into a helper crate, build it using build.rs and export it. Then in your main crate you can import MyWindow and then write something like this:

fn main() {
    let my_window_1 = MyWindow1::new();
    let my_window_2 = helper_create::MyWindow2::new();
    my_window_1.show();
    my_window_2.show();
    slint::run_event_loop();
}

I haven't tested this, but this might work as workaround until #784 is resolved.

I loved slint until I saw that you can create multiple windows, I tried the popupwindow and it turns out that if you open one popup inside another the app freezes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants