本文整理汇总了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
}