本文整理匯總了Golang中github.com/lxn/walk.Dialog.SetSuspended方法的典型用法代碼示例。如果您正苦於以下問題:Golang Dialog.SetSuspended方法的具體用法?Golang Dialog.SetSuspended怎麽用?Golang Dialog.SetSuspended使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/lxn/walk.Dialog
的用法示例。
在下文中一共展示了Dialog.SetSuspended方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Create
func (d Dialog) Create(owner walk.Form) error {
var w *walk.Dialog
var err error
if d.FixedSize {
w, err = walk.NewDialogWithFixedSize(owner)
} else {
w, err = walk.NewDialog(owner)
}
if err != nil {
return err
}
tlwi := topLevelWindowInfo{
Name: d.Name,
Font: d.Font,
ToolTipText: "",
MinSize: d.MinSize,
MaxSize: d.MaxSize,
ContextMenuItems: d.ContextMenuItems,
DataBinder: d.DataBinder,
Layout: d.Layout,
Children: d.Children,
OnKeyDown: d.OnKeyDown,
OnKeyPress: d.OnKeyPress,
OnKeyUp: d.OnKeyUp,
OnMouseDown: d.OnMouseDown,
OnMouseMove: d.OnMouseMove,
OnMouseUp: d.OnMouseUp,
OnSizeChanged: d.OnSizeChanged,
}
var db *walk.DataBinder
if d.DataBinder.AssignTo == nil {
d.DataBinder.AssignTo = &db
}
builder := NewBuilder(nil)
w.SetSuspended(true)
builder.Defer(func() error {
w.SetSuspended(false)
return nil
})
return builder.InitWidget(tlwi, w, func() error {
if err := w.SetTitle(d.Title); err != nil {
return err
}
if err := w.SetSize(d.Size.toW()); err != nil {
return err
}
if d.DefaultButton != nil {
if err := w.SetDefaultButton(*d.DefaultButton); err != nil {
return err
}
if db := *d.DataBinder.AssignTo; db != nil {
if db.DataSource() != nil {
(*d.DefaultButton).SetEnabled(db.CanSubmit())
}
db.CanSubmitChanged().Attach(func() {
(*d.DefaultButton).SetEnabled(db.CanSubmit())
})
}
}
if d.CancelButton != nil {
if err := w.SetCancelButton(*d.CancelButton); err != nil {
return err
}
}
if d.AssignTo != nil {
*d.AssignTo = w
}
return nil
})
}