本文整理汇总了Golang中github.com/lxn/walk.DataBinder.Reset方法的典型用法代码示例。如果您正苦于以下问题:Golang DataBinder.Reset方法的具体用法?Golang DataBinder.Reset怎么用?Golang DataBinder.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/lxn/walk.DataBinder
的用法示例。
在下文中一共展示了DataBinder.Reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: InitWidget
//.........这里部分代码省略.........
dataBinder, layout, children := dc.ContainerInfo()
if layout != nil {
l, err := layout.Create()
if err != nil {
return err
}
if err := wc.SetLayout(l); err != nil {
return err
}
}
b.parent = wc
defer func() {
b.parent = oldParent
}()
if g, ok := layout.(Grid); ok {
columns := b.columns
defer func() {
b.columns, b.row, b.col = columns, row, column+columnSpan
}()
b.columns = g.Columns
b.row = 0
b.col = 0
}
for _, child := range children {
if err := child.Create(b); err != nil {
return err
}
}
if dataBinder.AssignTo != nil || dataBinder.DataSource != nil {
if dataB, err := dataBinder.create(); err != nil {
return err
} else {
db = dataB
}
}
}
}
// Custom
if customInit != nil {
if err := customInit(); err != nil {
return err
}
}
b.parent = oldParent
// Widget continued
if font != nil {
if f, err := font.Create(); err != nil {
return err
} else if f != nil {
w.SetFont(f)
}
}
if b.level == 1 {
if err := b.initProperties(); err != nil {
return err
}
}
// Call Reset on DataBinder after customInit, so a Dialog gets a chance to first
// wire up its DefaultButton to the CanSubmitChanged event of a DataBinder.
if db != nil {
if _, ok := d.(Container); ok {
if wc, ok := w.(walk.Container); ok {
b.Defer(func() error {
// FIXME: Currently SetDataBinder must be called after initProperties.
wc.SetDataBinder(db)
if db.DataSource() == nil {
return nil
}
return db.Reset()
})
}
}
}
if b.level == 1 {
for _, f := range b.deferredFuncs {
if err := f(); err != nil {
return err
}
}
}
succeeded = true
return nil
}
示例2: InitWidget
//.........这里部分代码省略.........
rs := rowSpan
if rs < 1 {
rs = 1
}
r := walk.Rectangle{column, row, cs, rs}
if err := l.SetRange(w, r); err != nil {
return err
}
}
}
oldParent := b.parent
// Container
var db *walk.DataBinder
if dc, ok := d.(Container); ok {
if wc, ok := w.(walk.Container); ok {
dataBinder, layout, children := dc.ContainerInfo()
if layout != nil {
l, err := layout.Create()
if err != nil {
return err
}
if err := wc.SetLayout(l); err != nil {
return err
}
}
b.parent = wc
defer func() {
b.parent = oldParent
}()
for _, child := range children {
if err := child.Create(b); err != nil {
return err
}
}
var err error
if db, err = dataBinder.create(); err != nil {
return err
}
}
}
// Custom
if customInit != nil {
if err := customInit(); err != nil {
return err
}
}
b.parent = oldParent
// Widget continued
if font != nil {
if f, err := font.Create(); err != nil {
return err
} else if f != nil {
w.SetFont(f)
}
}
if b.level == 1 {
if err := b.initProperties(); err != nil {
return err
}
}
// Call Reset on DataBinder after customInit, so a Dialog gets a chance to first
// wire up its DefaultButton to the CanSubmitChanged event of a DataBinder.
if db != nil {
if _, ok := d.(Container); ok {
if wc, ok := w.(walk.Container); ok {
// FIXME: Currently SetDataBinder must be called after initProperties.
wc.SetDataBinder(db)
if err := db.Reset(); err != nil {
return err
}
}
}
}
if b.level == 1 {
for _, f := range b.deferredFuncs {
if err := f(); err != nil {
return err
}
}
}
succeeded = true
return nil
}
示例3: StartMF
//.........这里部分代码省略.........
DisplayMember: "Name",
Model: modelp.ShowTestIndus(),
},
Label{
Text: "经营范围:",
},
LineEdit{
Text: Bind("OrgBusScope"),
},
},
},
Composite{
Layout: HBox{},
Children: []Widget{
Label{
Text: "税收收入大于:",
},
NumberEdit{
Value: Bind("StatTaxSumStart", Range{0.00, 99999999999999999.99}),
Prefix: "¥ ",
Decimals: 2,
},
Label{
Text: "税收收入小于:",
},
NumberEdit{
Value: Bind("StatTaxSumEnd", Range{0.00, 99999999999999999.99}),
Prefix: "¥ ",
Decimals: 2,
},
},
},
Composite{
Layout: HBox{},
Children: []Widget{
CheckBox{
Checked: Bind("IsImportant"),
},
Label{
Text: "是否是重点税源企业",
},
CheckBox{
Checked: Bind("OrgIsExport"),
},
Label{
Text: "是否是出口企业",
},
PushButton{
Text: "抽查数据",
OnClicked: func() {
// 提交数据到绑定器
if err := binder.Submit(); err != nil {
log.Print(err)
return
}
// 执行查询并更新列表
fmt.Println("Params:", param)
model.RestRows(queryData(param))
},
},
PushButton{
Text: "导入数据",
OnClicked: func() {
mw.openFileAction()
},
},
PushButton{
Text: "刷新数据",
OnClicked: func() {
// 刷新行业列表
getCombs()
// 清空参数
err := binder.Reset()
if err != nil {
fmt.Println(err)
}
// 刷新数据
model.RestRows(defaDisplayData())
},
},
PushButton{
Text: "清空数据",
OnClicked: func() {
// 清空数据然后查询展示空列表
truncateData(vatTable)
model.RestRows(defaDisplayData())
walk.MsgBox(mw, "成功", "清空成功", walk.MsgBoxIconInformation)
},
},
},
},
},
},
},
// 这里直接Run,否则碰到了莫名奇妙的二次才能响应的问题
}.Run()); err != nil {
fmt.Println(err)
}
// mw.MainWindow.Run()
}