本文整理匯總了Golang中github.com/jroimartin/gocui.Gui.SetViewOnTop方法的典型用法代碼示例。如果您正苦於以下問題:Golang Gui.SetViewOnTop方法的具體用法?Golang Gui.SetViewOnTop怎麽用?Golang Gui.SetViewOnTop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/jroimartin/gocui.Gui
的用法示例。
在下文中一共展示了Gui.SetViewOnTop方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: prevView
func prevView(g *gocui.Gui, v *gocui.View) error {
curView = getCurrentChannelIndex()
next := curView - 1
if next < 0 {
next = len(Server.Channels) - 1
}
logger.Logger.Printf("PREV INDEX %d\n", next)
if newView, err := g.View(Server.Channels[next].Name); err != nil {
return err
} else {
newView.Autoscroll = true
g.SetViewOnTop(newView.Name())
g.SetViewOnTop("header")
}
if _, err := g.SetCurrentView(Server.Channels[next].Name); err != nil {
return err
}
// logger.Logger.Printf("Set Current View %d\n", Server.Channels[next].Name)
Server.CurrentChannel = Server.Channels[next].Name
Server.Channels[next].Unread = false
ui.UpdateMenuView(g)
FocusInputView(g, v)
curView = next
return nil
}
示例2: reloadMenu
func reloadMenu(g *gocui.Gui) error {
v, err := g.View("menu")
if err != nil {
return err
}
v.Clear()
PrintMenu(v)
if cmdMode {
prefix := fmt.Sprintf(cmdPrefix, cTubes.Selected)
if err = v.SetCursor(len(prefix), 0); err != nil {
return err
}
}
_, err = g.SetViewOnTop("menu")
return err
}
示例3: keybindings
func keybindings(g *gocui.Gui) error {
err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error {
return gocui.ErrQuit
})
if err != nil {
return err
}
err = g.SetKeybinding("", '1', gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error {
_, err := g.SetViewOnTop("v1")
return err
})
if err != nil {
return err
}
err = g.SetKeybinding("", '2', gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error {
_, err := g.SetViewOnTop("v2")
return err
})
if err != nil {
return err
}
err = g.SetKeybinding("", '3', gocui.ModNone, func(g *gocui.Gui, v *gocui.View) error {
_, err := g.SetViewOnTop("v3")
return err
})
if err != nil {
return err
}
return nil
}
示例4: UpdateHeaderView
func UpdateHeaderView(g *gocui.Gui) {
Server.Exec("header", func(g *gocui.Gui, v *gocui.View, s *client.Server) error {
v.Clear()
v.SetCursor(0, 0)
g.SetViewOnTop(v.Name())
channel := Server.GetCurrentChannel()
if channel.Name != client.StatusChannel {
if len(channel.Name) <= 0 {
fmt.Fprintf(v, "⣿ %s", "Loading...")
} else {
fmt.Fprintf(v, "⣿ %s", channel.Topic)
}
} else if channel.Name == client.StatusChannel {
fmt.Fprintf(v, "⣿ %s", client.StatusChannel)
} else {
fmt.Fprintf(v, "⣿ %s", "Loading...")
}
return nil
})
}
示例5: setCurrentViewOnTop
func setCurrentViewOnTop(g *gocui.Gui, name string) (*gocui.View, error) {
if _, err := g.SetCurrentView(name); err != nil {
return nil, err
}
return g.SetViewOnTop(name)
}
示例6: ontop
func ontop(g *gocui.Gui, v *gocui.View) error {
_, err := g.SetViewOnTop(views[curView])
return err
}