Skip to content

Widget Self Referencing #4392

Answered by Jacalz
Acetolyne asked this question in Q&A
Nov 16, 2023 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

To answer your question:

You just set the OnCancel method later:

deviceForm := &widget.Form{
		Items: []*widget.FormItem{
			{Text: "Name", Widget: name},
			{Text: "URL", Widget: url},
		},
		OnSubmit: func() {
			log.Println("device:", name.Text)
			log.Println("url:", url.Text)
		},
		SubmitText: "Add Device",
		CancelText: "Cancel",

}
deviceForm.OnCancel = func() {
	deviceForm.Hide()
	fmt.Println("Hide the form")
}
deviceForm.Hide()

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@Acetolyne
Comment options

@Jacalz
Comment options

Jacalz Nov 16, 2023
Collaborator

Answer selected by Acetolyne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #4391 on November 16, 2023 15:00.