當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Gui.SetViewOnTop方法代碼示例

本文整理匯總了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
}
開發者ID:mephux,項目名稱:komanda-cli,代碼行數:33,代碼來源:util.go

示例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
}
開發者ID:george-infinity,項目名稱:bsw,代碼行數:20,代碼來源:main.go

示例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
}
開發者ID:jroimartin,項目名稱:gocui,代碼行數:34,代碼來源:ontop.go

示例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
	})
}
開發者ID:mephux,項目名稱:komanda-cli,代碼行數:24,代碼來源:header.go

示例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)
}
開發者ID:jmptrader,項目名稱:gocui,代碼行數:6,代碼來源:active.go

示例6: ontop

func ontop(g *gocui.Gui, v *gocui.View) error {
	_, err := g.SetViewOnTop(views[curView])
	return err
}
開發者ID:jmptrader,項目名稱:gocui,代碼行數:4,代碼來源:dynamic.go


注:本文中的github.com/jroimartin/gocui.Gui.SetViewOnTop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。