rivo / tview

Terminal UI library with rich, interactive widgets — written in Golang
MIT License
11.17k stars 574 forks source link

Exposing open state for the DropDown widget #810

Closed konaraya closed 1 year ago

konaraya commented 1 year ago

This library has been very useful to quickly build a terminal UI. Many thanks for the great work.

I was trying to make form navigation slightly more easier to use, especially in places where BackTab doesn't work. I can use SetInputCapture, and push KeyTab events when Arrow events are received and it makes it better. Only minor hiccup is the DropDown where the arrow keys are used to select the items themselves. Currently the open flag is private to the DropDown struct, so I can't use it in the logic within SetInputCapture. Having a IsOpen() member function that returns this value would be useful in my opinion. It would be a single line change, I can gladly open a PR if you agree.

rivo commented 1 year ago

I added IsOpen() with the latest commit.