Adjusted sysData.make() to make the new window class and fixed main(). Now to fix compiler errors...
This commit is contained in:
parent
40dc20be0d
commit
8e2f3b136e
5
main.go
5
main.go
|
@ -5,8 +5,7 @@ func main() {
|
||||||
w := NewWindow("Main Window", 320, 240)
|
w := NewWindow("Main Window", 320, 240)
|
||||||
w.Closing = make(chan struct{})
|
w.Closing = make(chan struct{})
|
||||||
b := NewButton("Click Me")
|
b := NewButton("Click Me")
|
||||||
w.SetControl(b)
|
err := w.Open(b)
|
||||||
err := w.Open()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -22,6 +21,6 @@ mainloop:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.Close()
|
w.Hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ const controlxstyle = 0
|
||||||
|
|
||||||
var classTypes = [nctypes]*classData{
|
var classTypes = [nctypes]*classData{
|
||||||
c_window: &classData{
|
c_window: &classData{
|
||||||
name: stdWndClass,
|
|
||||||
style: _WS_OVERLAPPEDWINDOW,
|
style: _WS_OVERLAPPEDWINDOW,
|
||||||
xstyle: 0,
|
xstyle: 0,
|
||||||
},
|
},
|
||||||
|
@ -59,17 +58,24 @@ func (s *sysData) make(initText string, initWidth int, initHeight int, window *s
|
||||||
ret := make(chan uiret)
|
ret := make(chan uiret)
|
||||||
defer close(ret)
|
defer close(ret)
|
||||||
ct := classTypes[s.ctype]
|
ct := classTypes[s.ctype]
|
||||||
|
classname := ct.name
|
||||||
cid := _HMENU(0)
|
cid := _HMENU(0)
|
||||||
pwin := uintptr(_NULL)
|
pwin := uintptr(_NULL)
|
||||||
if window != nil { // this is a child control
|
if window != nil { // this is a child control
|
||||||
cid = window.addChild(s)
|
cid = window.addChild(s)
|
||||||
pwin = uintptr(window.hwnd)
|
pwin = uintptr(window.hwnd)
|
||||||
|
} else { // need a new class
|
||||||
|
n, err := registerStdWndClass(s)
|
||||||
|
if err != nil {
|
||||||
|
return r.err
|
||||||
|
}
|
||||||
|
classname = n
|
||||||
}
|
}
|
||||||
uitask <- &uimsg{
|
uitask <- &uimsg{
|
||||||
call: _createWindowEx,
|
call: _createWindowEx,
|
||||||
p: []uintptr{
|
p: []uintptr{
|
||||||
uintptr(ct.xstyle),
|
uintptr(ct.xstyle),
|
||||||
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(ct.name))),
|
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(classname))),
|
||||||
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(initText))),
|
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(initText))),
|
||||||
uintptr(ct.style),
|
uintptr(ct.style),
|
||||||
uintptr(_CW_USEDEFAULT), // TODO
|
uintptr(_CW_USEDEFAULT), // TODO
|
||||||
|
|
Loading…
Reference in New Issue