Clicking on a form outside a form item will focus it. Fixes #793

This commit is contained in:
Oliver 2023-03-20 10:52:35 +01:00
parent 47b3275db4
commit 84f9c0ff9d
2 changed files with 2 additions and 1 deletions

View File

@ -53,6 +53,7 @@ For a presentation highlighting this package, compile and run the program found
## Projects using `tview` ## Projects using `tview`
- [K9s - Kubernetes CLI](https://github.com/derailed/k9s)
- [IRCCloud Terminal Client](https://github.com/termoose/irccloud) - [IRCCloud Terminal Client](https://github.com/termoose/irccloud)
- [Window manager for `tview`](https://github.com/epiclabs-io/winman) - [Window manager for `tview`](https://github.com/epiclabs-io/winman)
- [CLI bookmark manager](https://github.com/Endi1/drawer) - [CLI bookmark manager](https://github.com/Endi1/drawer)
@ -62,7 +63,6 @@ For a presentation highlighting this package, compile and run the program found
- [Terminal UI for todist](https://github.com/cyberdummy/todoista) - [Terminal UI for todist](https://github.com/cyberdummy/todoista)
- [Graphical kubectl wrapper](https://github.com/dcaiafa/kpick) - [Graphical kubectl wrapper](https://github.com/dcaiafa/kpick)
- [Decred Decentralized Exchange ](https://github.com/decred/dcrdex) - [Decred Decentralized Exchange ](https://github.com/decred/dcrdex)
- [Kubernetes CLI To Manage Your Clusters In Style! ](https://github.com/derailed/k9s)
- [A CLI file browser for Raspberry PI](https://github.com/destinmoulton/pixi) - [A CLI file browser for Raspberry PI](https://github.com/destinmoulton/pixi)
- [A tool to manage projects.](https://github.com/divramod/dp) - [A tool to manage projects.](https://github.com/divramod/dp)
- [A simple app for BMI monitoring](https://github.com/erleene/go-bmi) - [A simple app for BMI monitoring](https://github.com/erleene/go-bmi)

View File

@ -802,6 +802,7 @@ func (f *Form) MouseHandler() func(action MouseAction, event *tcell.EventMouse,
// A mouse down anywhere else will return the focus to the last selected // A mouse down anywhere else will return the focus to the last selected
// element. // element.
if action == MouseLeftDown && f.InRect(event.Position()) { if action == MouseLeftDown && f.InRect(event.Position()) {
f.Focus(setFocus)
consumed = true consumed = true
} }