mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[GH-ISSUE #806] keep focus on the modal #589
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#589
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tcurdt on GitHub (Jan 31, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/806
When I have two pages, one for a modal
I can still switch focus with the mouse and access the controls that are in the background.
Is there an easy way to disable this?
I know I could use
HidePage()before I open the modal but I would like to still have the background visible - just not accessible.@tcurdt commented on GitHub (Jan 31, 2023):
I just found this dialog implementation that wraps the input/mouse handler. That's the only way I assume?
@tcurdt commented on GitHub (Jan 31, 2023):
It's
visibleand notfocusedhttps://github.com/rivo/tview/blob/master/pages.go#L64
...and from the comments it sounds like
SetFocusis called from the library. So 🤷♂️@tcurdt commented on GitHub (Feb 1, 2023):
But we are on the page level and the focus can also be set by the mouse.
So I don't get how how that is relevant.
Not my first rodeo and I only open issue when I have
If I have missed information I am sorry and would love a link pointing me into the right direction.
Searching 10+ other projects in the hope they have implemented what I am looking for is not a particular great use of our collective time TBH. But I have already linked to an implementation further up and would just like to know if that's the intended way of doing things.
I came across it before - not sure how I feel about the whole gitlab/self-hosted/mirrored storry.
Without a link to the code it's a nice encouragement - but otherwise not that helpful ;)
Maybe add that as another demo?
@OsvaldoTCF commented on GitHub (May 9, 2024):
.

.
Perhaps the solution is to interfere with the flow of mouse events by accepting only events destined for the current primitive.
@OsvaldoTCF commented on GitHub (May 9, 2024):
This way worked for a small example.
The ideal would be to get the "primitive" on which the "click" is being made.
//
if err := tview.NewApplication().SetRoot(pages, true).
SetMouseCapture(mcap).EnableMouse(true).Run(); err != nil {
panic(err)
func mcap(event *tcell.EventMouse, action tview.MouseAction) (*tcell.EventMouse, tview.MouseAction) {
if action == 0 {
return event, action
}
}