Fixed compiler errors. New code structure success!
This commit is contained in:
parent
8e2f3b136e
commit
3d2df2334e
|
@ -2,7 +2,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
)
|
||||
|
||||
|
@ -36,9 +35,7 @@ func (b *Button) SetText(text string) (err error) {
|
|||
b.lock.Lock()
|
||||
defer b.lock.Unlock()
|
||||
|
||||
if b.pWin != nil && b.pWin.created {
|
||||
panic("TODO")
|
||||
}
|
||||
// TODO handle created
|
||||
b.initText = text
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -27,12 +27,12 @@ func stdWndProc(s *sysData) func(hwnd _HWND, uMsg uint32, wParam _WPARAM, lParam
|
|||
case _WM_COMMAND:
|
||||
id := _HMENU(wParam.LOWORD())
|
||||
s.childrenLock.Lock()
|
||||
defer s.childrenLock.Unlock()
|
||||
ss = s.children[id]
|
||||
ss := s.children[id]
|
||||
s.childrenLock.Unlock()
|
||||
switch ss.ctype {
|
||||
case c_button:
|
||||
if wParam.HIWORD() == _BN_CLICKED {
|
||||
sysData.event <- struct{}{}
|
||||
ss.event <- struct{}{}
|
||||
}
|
||||
}
|
||||
return 0
|
||||
|
|
|
@ -40,10 +40,13 @@ var classTypes = [nctypes]*classData{
|
|||
},
|
||||
}
|
||||
|
||||
func (s *sysData) addChild(chlid *sysData) _HMENU {
|
||||
func (s *sysData) addChild(child *sysData) _HMENU {
|
||||
s.childrenLock.Lock()
|
||||
defer s.childrenLock.Unlock()
|
||||
s.nextChildID++ // start at 1
|
||||
if s.children == nil {
|
||||
s.children = map[_HMENU]*sysData{}
|
||||
}
|
||||
s.children[s.nextChildID] = child
|
||||
return s.nextChildID
|
||||
}
|
||||
|
@ -54,6 +57,7 @@ func (s *sysData) delChild(id _HMENU) {
|
|||
delete(s.children, id)
|
||||
}
|
||||
|
||||
// TODO adorn error messages with what stage failed?
|
||||
func (s *sysData) make(initText string, initWidth int, initHeight int, window *sysData) (err error) {
|
||||
ret := make(chan uiret)
|
||||
defer close(ret)
|
||||
|
@ -67,7 +71,7 @@ func (s *sysData) make(initText string, initWidth int, initHeight int, window *s
|
|||
} else { // need a new class
|
||||
n, err := registerStdWndClass(s)
|
||||
if err != nil {
|
||||
return r.err
|
||||
return err
|
||||
}
|
||||
classname = n
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue