本文整理汇总了Golang中github.com/gbin/goncurses.Window.AttrOff方法的典型用法代码示例。如果您正苦于以下问题:Golang Window.AttrOff方法的具体用法?Golang Window.AttrOff怎么用?Golang Window.AttrOff使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/gbin/goncurses.Window
的用法示例。
在下文中一共展示了Window.AttrOff方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: update
func update(s *state, stdscr *gc.Window) {
stdscr.Clear()
var last_found *section
var ascii rune
for i := 0; i < len(s.content); i++ {
found := s.matches[i]
if found != nil {
last_found = found
// Print the associated key instead of the real letter
stdscr.AttrOn(gc.A_BOLD)
for k, v := range s.index {
if found == v {
ascii = k
break
}
}
stdscr.Print(string(ascii))
stdscr.AttrOff(gc.A_BOLD)
} else {
// Print the real letter, in bold if selected
if last_found != nil && i >= last_found.begin && i <= last_found.end && strings.Contains(s.selected, string(ascii)) {
stdscr.AttrOn(gc.A_BOLD)
}
ch := string(s.content[i])
// if (s.content[i] != '\n' ) {
stdscr.Print(ch)
// }
stdscr.AttrOff(gc.A_BOLD)
}
}
// row, _ := stdscr.MaxYX()
// stdscr.MovePrint(row - 1, 0, "selected = " + s.selected + "] >> ")
stdscr.Refresh()
}
示例2: printmenu
func printmenu(w *gc.Window, menu []string, active int) {
y, x := 2, 2
w.Box(0, 0)
for i, s := range menu {
if i == active {
w.AttrOn(gc.A_REVERSE)
w.MovePrint(y+i, x, s)
w.AttrOff(gc.A_REVERSE)
} else {
w.MovePrint(y+i, x, s)
}
}
w.Refresh()
}