summaryrefslogtreecommitdiff
path: root/window.go
diff options
context:
space:
mode:
Diffstat (limited to 'window.go')
-rw-r--r--window.go20
1 files changed, 8 insertions, 12 deletions
diff --git a/window.go b/window.go
index b348ae8..57283f2 100644
--- a/window.go
+++ b/window.go
@@ -88,20 +88,15 @@ func (w *Window) SetSpaced(spaced bool) {
// Open creates the Window with Create and then shows the Window with Show. As with Create, you cannot call Open more than once per window.
func (w *Window) Open(control Control) {
- done := make(chan struct{})
- defer close(done)
- touitask(func() {
- w.Create(control)
- w.Show()
- done <- struct{}{}
- })
- <-done
+ w.create(control, true)
}
// Create creates the Window, setting its control to the given control. It does not show the window. This can only be called once per window, and finalizes all initialization of the control.
func (w *Window) Create(control Control) {
- done := make(chan struct{})
- defer close(done)
+ w.create(control, false)
+}
+
+func (w *Window) create(control Control, show bool) {
touitask(func() {
if w.created {
panic("window already open")
@@ -128,9 +123,10 @@ func (w *Window) Create(control Control) {
}
w.sysData.setText(w.initTitle)
w.created = true
- done <- struct{}{}
+ if show {
+ w.Show()
+ }
})
- <-done
}
// Show shows the window.