本文整理匯總了Golang中github.com/jroimartin/gocui.Gui.Cursor方法的典型用法代碼示例。如果您正苦於以下問題:Golang Gui.Cursor方法的具體用法?Golang Gui.Cursor怎麽用?Golang Gui.Cursor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/jroimartin/gocui.Gui
的用法示例。
在下文中一共展示了Gui.Cursor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: nextView
func nextView(g *gocui.Gui, v *gocui.View) error {
g.Cursor = false
v.Highlight = false
log.Println("nextView: " + v.Name())
var err error
switch v.Name() {
case "channels":
err = g.SetCurrentView("input")
g.Cursor = true
case "input":
err = g.SetCurrentView("channels")
g.CurrentView().Highlight = true
}
// g.Flush()
return err
}
示例2: toggleCmdMode
func toggleCmdMode(g *gocui.Gui, v *gocui.View) error {
var nv string
tv, err := g.View("tubes")
if err != nil {
return err
}
if !cmdMode {
cmdMode = true
g.Cursor = true
nv = "menu"
//Clear the tube list and set autoscroll for command responses
tv.Clear()
tv.Autoscroll = true
PrintLine(tv, fmt.Sprintf("Running commands on %s:\n", cTubes.Selected))
} else {
cmdMode = false
g.Cursor = false
nv = "tubes"
//Reset the view origin and disable autoscroll
tv.SetOrigin(0, 0)
tv.Autoscroll = false
//Reload the tube list
if err := reloadTubes(g); err != nil {
return err
}
}
if err := reloadMenu(g); err != nil {
return err
}
return g.SetCurrentView(nv)
}
示例3: nextView
func nextView(g *gocui.Gui, v *gocui.View) error {
nextIndex := (active + 1) % len(viewArr)
name := viewArr[nextIndex]
out, err := g.View("v2")
if err != nil {
return err
}
fmt.Fprintln(out, "Going from view "+v.Name()+" to "+name)
if _, err := setCurrentViewOnTop(g, name); err != nil {
return err
}
if nextIndex == 0 || nextIndex == 3 {
g.Cursor = true
} else {
g.Cursor = false
}
active = nextIndex
return nil
}