Documentation ¶
Overview ¶
Package that contains variety of dialogs
Example of using InputDialog
input := make(chan string) //Prevents nested dialogs and other glitches (like double handler call) for _, view := range gui.Views() { gui.DeleteKeybindings(view.Name()) } utils.ErrCheck( mngr.SelectView( gui, dialog.InputDialog("Are you sure? [y/n]", "", "", gui, input).Name())) go func() { if userInput, ok := <-input; ok { log.Print(userInput) } SetKeyBindings(gui, mngr) }()
Similar example for ConfirmDialog
option := make(chan bool) previousView := gui.CurrentView() log.Println("callback: ", previousView.Name()) //Prevents nested dialogs and other glitches (like double handler call) for _, view := range gui.Views() { gui.DeleteKeybindings(view.Name()) } utils.ErrCheck( mngr.SelectView( gui, dialog.ConfirmDialog("message", "title", gui, option).Name())) go func() { if choice, ok = <-option; ok { log.Printf("Choosen option: %v", choice) } mngr.currView = previousView log.Println("thread: ", mngr.currView.Name(), previousView.Name()) SetKeyBindings(gui, mngr) }()
Remember! When user chooses an option, it deletes returned view, so make sure to handle it properly. If you don't, it may cause Unknown view error
Index ¶
- func ConfirmDialog(msg, title string, gui *gocui.Gui, choice chan bool) (view *gocui.View)
- func DeleteDialog(gui *gocui.Gui, dialogViews ...*gocui.View) error
- func InputDialog(msg, title, initValue string, gui *gocui.Gui, input chan string) [2]*gocui.View
- func LabelDialog(gui *gocui.Gui, labelChan chan [2]string) gocui.Manager
- func SelectDialog(title string, gui *gocui.Gui, selIdxC chan int, values []string) *gocui.View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfirmDialog ¶
Provides option dialog. User can make decision with 'y' and 'n' key.
func InputDialog ¶
Provides dialog with an input field
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.