gcla / gowid

Compositional widgets for terminal user interfaces, written in Go, inspired by urwid.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usage questions

r-smith opened this issue · comments

  1. Is there any way to completely disable logging?

  2. On a list widget, is there a way to tell if there is more content above or below what is currently shown on the screen? I found the AtTop, AtBottom, and AtMiddle functions, but they don't seem to work like I'm thinking. I just wanted some way to indicate to the user that there are additional items to scroll through. I can't figure out exactly what the gowid-editor in the examples folder is doing with vscroll.

Hi Ryan - to disable logging, try something like this:

	logger := logrus.New()
	logger.Out = ioutil.Discard

	app, err = gowid.NewApp(gowid.AppArgs{
                ...
		Log:     logger,
	})

For the list - there is a newer example in termshark's code - here's a link:
https://github.com/gcla/termshark/blob/master/widgets/withscrollbar/withscrollbar.go. It relies on list.CalculateOnScreen() which will return 3 integers, hopefully giving you what you need. If the first value is zero, then the list is rendering the first item in its walker; if the last value is zero, it's at the end. Let me know if that does the trick. The most recent changes in gowid prior to putting it on github were all driven by termshark, and I had the luxury of being able to change either how I liked. From time to time I felt the APIs weren't really general enough, or a bit rushed. So I'm very interested to hear your opinion what might be improved.

Thanks, I was able to get my scroller-type widget to work based on your example.