func (b Button) Create(window *MainWindow) { win := *window.AssignTo c := gowi.NewButton(*win, b.ID) if b.Text != nil { c.SetWindowText(b.Text.(string)) } if b.Enabled != nil { c.SetEnabled(b.Enabled.(bool)) } if b.Visible != nil { c.SetVisible(b.Visible.(bool)) } c.OnClicked = b.OnClicked if b.AssignTo != nil { *b.AssignTo = c } }
func NewMainWindow() *MainWindow { w := &MainWindow{} w.Create(IDD_MAIN) b1 := gowi.NewButton(w.MainWindow, IDD_BUTTON1) l1 := gowi.NewLabel(w.MainWindow, IDD_LABEL1) b1.OnClicked = w.OnButton1Clicked l1.SetWindowText("Hello!") w.button1 = b1 w.label1 = l1 return w }