asticode / go-astilectron

Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)
MIT License
4.9k stars 344 forks source link

Can not relaunch window after w.Close() #371

Closed Dontmindmes closed 2 years ago

Dontmindmes commented 2 years ago

Hello,

I encounter an issue, when i create a window for example "w.Create()" and i display the window because it was created, and i close it so its no longer visible and attempt to call the same window "w" from one of my other windows it does not let me "w.Create()" or "w.Show()" the window after i run "w.Close()", how can i display the window again after closing it?

Thank you

asticode commented 2 years ago

Once the window is closed, you can't reuse it. What you seem to be looking to do instead is hiding the windows instead of closing it.

Dontmindmes commented 2 years ago

But when i use hide and all windows are closed through the close button at the frame the program keeps running because the window is hidden

asticode commented 2 years ago

If you use the window closed and hide event, you can know which of your windows are closed and hidden. Then, based on this info, when you think the program should be closed, you can use the Stop method to stop the program.