本文整理匯總了Golang中github.com/lxn/walk.PushButton.Clicked方法的典型用法代碼示例。如果您正苦於以下問題:Golang PushButton.Clicked方法的具體用法?Golang PushButton.Clicked怎麽用?Golang PushButton.Clicked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/lxn/walk.PushButton
的用法示例。
在下文中一共展示了PushButton.Clicked方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: showDialogAction_Triggered
func (mw *MyMainWindow) showDialogAction_Triggered() {
dlg := new(MyDialog)
var acceptPB *walk.PushButton
var le1, le2 *walk.LineEdit
widgets := []Widget{
Label{Row: 0, Column: 0, Text: "A LineEdit:"},
LineEdit{Row: 0, Column: 1, AssignTo: &le1, OnTextChanged: func() { le2.SetText(le1.Text()) }},
ToolButton{Row: 0, Column: 2, Text: "..."},
Label{Row: 1, Column: 0, Text: "Another LineEdit:"},
LineEdit{Row: 1, Column: 1, AssignTo: &le2},
Label{Row: 2, Column: 0, Text: "A ComboBox:"},
ComboBox{Row: 2, Column: 1},
VSpacer{Row: 3, Column: 0, Size: 10},
Label{Row: 4, Column: 0, ColumnSpan: 2, Text: "A TextEdit:"},
TextEdit{Row: 5, Column: 0, ColumnSpan: 2},
}
dd := &DialogDecl{
Title: "My Dialog",
Owner: mw,
Dialog: &dlg.Dialog,
AcceptPB: &acceptPB,
Widgets: widgets,
MinSize: Size{400, 300},
}
if err := dd.Create(); err != nil {
log.Fatal(err)
}
acceptPB.Clicked().Attach(func() {
dlg.Accept()
})
dlg.Run()
}