Skip to content

multi_window example too simple #459

@PerBothner

Description

@PerBothner

This isn't really a feature request but rather a request to enhance the example applications.
Warning: I am quite new to Rust, and it is quite likely an experienced Rust programmer would not have these problems.

I'm trying to create multiple non-trivial windows in the same application. The examples/multi_window.rs is a bit too simple, in that window2 is relatively simple and very different from window1. I'd like openWindow to create the same kind of window, which means using the same new_window function/closure to create both. But then I get into nasty move/ownership issues, which I haven't been able to solve, so far.

Attached is what I have so far. It builds and runs - but as soon as I uncomment the second new_window call I get lots of errors. What is the clean/recommended way to get that functionality? (Feel free to use anything in my code that you find useful if you enhance the examples.) The use of "http://example.com" is just a place-holder. Most likely would be to enhance the UserEvent::NewWindow to pass suitable options from JavaScript to the rpc-handler to the event_loop handler.

main-rs.txt

Note I also used the seemingly-newer EventLoop::with_use_event idiom from custom_titlebar.rs, instead of the mpsc::channel logic from multi_window.rs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions