當前位置: 首頁>>代碼示例>>Golang>>正文


Golang DataBinder.Reset方法代碼示例

本文整理匯總了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
}
開發者ID:linhua55,項目名稱:walk,代碼行數:101,代碼來源:builder.go

示例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
}
開發者ID:Robin3D,項目名稱:walk,代碼行數:101,代碼來源:builder.go

示例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()
}
開發者ID:LaughingVzr,項目名稱:taxrecrd,代碼行數:101,代碼來源:mainfrm.go


注:本文中的github.com/lxn/walk.DataBinder.Reset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。