Added the init and testing main functions and started fixing errors. Let's fix the rest and hope it works...

This commit is contained in:
Pietro Gagliardi 2014-02-11 18:57:03 -05:00
parent 7686c6e599
commit 09a42e0c34
6 changed files with 33 additions and 4 deletions

17
init.go Normal file
View File

@ -0,0 +1,17 @@
// 11 february 2014
//package ui
package main
// TODO this will be system-defined
func initpanic(err error) {
panic("failure during init: " + err.Error())
}
func init() {
initDone := make(chan error)
go ui(initDone)
err := <-initDone
if err != nil {
initpanic(err)
}
}

View File

@ -69,7 +69,7 @@ func doWindowsInit() (err error) {
}
err = registerStdWndClass()
if err != nil {
reteurn fmt.Errorf("error registering standard window class: %v", err)
return fmt.Errorf("error registering standard window class: %v", err)
}
// TODO others
return nil // all ready to go

11
main.go Normal file
View File

@ -0,0 +1,11 @@
// 11 february 2014
package main
func main() {
w := NewWindow("Main Window")
w.Closing = make(chan struct{})
w.Open()
<-w.Closing
w.Close()
}

View File

@ -1,6 +1,8 @@
// 7 february 2014
package main
//+build skip
import (
"fmt"
"os"

View File

@ -5,7 +5,6 @@ import (
"fmt"
"syscall"
"unsafe"
"sync"
)
const (
@ -34,7 +33,7 @@ func stdWndProc(hwnd _HWND, uMsg uint32, wParam _WPARAM, lParam _LPARAM) _LRESUL
return 0
case _WM_CLOSE:
if sysData.closing != nil {
sysData.closing <- struct{}
sysData.closing <- struct{}{}
}
return 0
default:

View File

@ -19,7 +19,7 @@ func (c *cSysData) make() error {
func (c *cSysData) show() error {
panic(runtime.GOOS + " sysData does not define show()")
}
func (c *cSysData) show() error {
func (c *cSysData) hide() error {
panic(runtime.GOOS + " sysData does not define hide()")
}