Beispiel #1
0
func (rbgb RadioButtonGroupBox) Create(builder *Builder) error {
	w, err := walk.NewGroupBox(builder.Parent())
	if err != nil {
		return err
	}

	w.SetSuspended(true)
	builder.Defer(func() error {
		w.SetSuspended(false)
		return nil
	})

	return builder.InitWidget(rbgb, w, func() error {
		if err := w.SetTitle(rbgb.Title); err != nil {
			return err
		}

		if err := (RadioButtonGroup{
			DataMember: rbgb.DataMember,
			Optional:   rbgb.Optional,
			Buttons:    rbgb.Buttons,
		}).Create(builder); err != nil {
			return err
		}

		if rbgb.AssignTo != nil {
			*rbgb.AssignTo = w
		}

		return nil
	})
}
Beispiel #2
0
func (gb GroupBox) Create(builder *Builder) error {
	w, err := walk.NewGroupBox(builder.Parent())
	if err != nil {
		return err
	}

	w.SetSuspended(true)
	builder.Defer(func() error {
		w.SetSuspended(false)
		return nil
	})

	return builder.InitWidget(gb, w, func() error {
		if err := w.SetTitle(gb.Title); err != nil {
			return err
		}

		if gb.AssignTo != nil {
			*gb.AssignTo = w
		}

		return nil
	})
}