Implemented the new events in the portable code.
This commit is contained in:
parent
d13e398e90
commit
c8ae74cf26
|
@ -36,6 +36,9 @@ func (b *Button) Text() string {
|
|||
}
|
||||
|
||||
func (b *Button) make(window *sysData) error {
|
||||
b.sysData.event = func() {
|
||||
window.winhandler.Event(Clicked, b)
|
||||
}
|
||||
err := b.sysData.make(window)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -10,7 +10,8 @@ type cSysData struct {
|
|||
alternate bool // editable for Combobox, multi-select for listbox, password for lineedit
|
||||
handler AreaHandler // for Areas; TODO rename to areahandler
|
||||
winhandler WindowHandler // for Windows
|
||||
event func() // provided by each widget
|
||||
close func(*bool) // provided by each Window
|
||||
event func() // provided by each control
|
||||
}
|
||||
|
||||
// this interface is used to make sure all sysDatas are synced
|
||||
|
|
|
@ -98,6 +98,10 @@ func (w *Window) Create(control Control) {
|
|||
panic("window already open")
|
||||
}
|
||||
w.sysData.spaced = w.spaced
|
||||
w.sysData.winhandler = w.handler
|
||||
w.sysData.close = func(b *bool) {
|
||||
w.sysData.winhandler.Event(Closing, b)
|
||||
}
|
||||
err := w.sysData.make(nil)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("error opening window: %v", err))
|
||||
|
|
Loading…
Reference in New Issue