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

Add support for Multi Window #151

Open
edgarfgp opened this issue Jul 1, 2023 · 1 comment
Open

Add support for Multi Window #151

edgarfgp opened this issue Jul 1, 2023 · 1 comment

Comments

@edgarfgp
Copy link
Member

edgarfgp commented Jul 1, 2023

  • Custom FabAvaloniaApp
  • Make DestopApplication a CollectionBuilder
  • Create a custom window with an Id so we can look up it.

Pseudocode:

new Avalonia.Window().Show() -->  Application.Windows[1]

Application(Window())

Application() {
    Window()
    Window() --> Fabulous can not add to ReadOnlyList
}

Application() {
    // This is the main window
    Window(...)

    // This is the second window
    Window(id = "secondWindow", content = ...)
}

type FabWindow() =
    inherit Window()

    member this.WindowId

type FabAvaloniaApp() =
    inherit Application()

    member this.InternalWindows = new List<Window>()    <--- this one

    override this.MainWindow = this.InternalWindows[0]

    member this.OpenWindow(id: string) =
        let window = this.InternalWindows |> List.find (fun w -> w.WindowId = id)
        window.Show()


Button("Open second window", Clicked)

match msg with
| Clicked -> Application.Current.OpenWindow("secondWindow")
@katatunix
Copy link

Yes, I need this too.

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

2 participants