asticode / go-astilectron

Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to operate the window after Wait() is executed

heary29 opened this issue · comments

Hello, maybe my method is wrong, but what I want to achieve is that after the astilectron is successfully created, after the Wait() function is executed, I want to hide a window created before to show it, I try to execute window.Show( ), unfortunately it has no effect. I know that after Wait is executed, it enters the block, so what can I do to make the previously hidden window show? Or how to make the operation of the window take effect after Wait()?

are you using the bootstrap or astilectron directly?

Yes, I use astilectron directly

if you want to execute something after Wait() I would suggest using a goroutine:

// TODO Setup your window
var w *astilectron.Window

// Do your thing
go func() {
  w.Show()
}()

// Still wait here so that process is closed properly
a.Wait()

If not directly using astilen, how to operate the previously created window after wait()?

You can use the OnWait function of the bootstrap to store your window in a local variable and use it outside the Wait() loop