sciter-sdk / go-sciter

Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
https://sciter.com
2.57k stars 268 forks source link

how to close the main window #184

Closed TerryMarszr0 closed 5 years ago

TerryMarszr0 commented 5 years ago

how to close the main window

pravic commented 5 years ago

By pressing the [X] button? Your question is a bit ambiguous.

TerryMarszr0 commented 5 years ago

i want to delay to destory the main window ,code as below ,but it looks like cant destory main window or break main window

    go func() {
        time.Sleep(30 * time.Second)
        //hwnd := appWindow.GetHwnd()
        hwdn := win.HWND(unsafe.Pointer(appWindow.GetHwnd()))
        win.SendMessage(hwdn, win.WM_CLOSE, 0, 0)
        //win.DestroyWindow(hwdn)

    }()
pravic commented 5 years ago

You can't sleep in UI thread (and goroutine does not guarantee you that it will be run in a separate thread). Use timers.

TIScript:

self.timer(30*1000, function() { view.close(); });
TerryMarszr0 commented 5 years ago

thanks