mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[GH-ISSUE #728] Parenting API for cascading shortcut processing #532
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#532
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 @abitrolly on GitHub (Apr 28, 2022).
Original GitHub issue: https://github.com/rivo/tview/issues/728
I still need Qt Parenting System for blocking modal in #662 to start shortcut processing from the topmost widget and then forward unhandled shortcuts to parents. The problem is that
tviewdoesn't have this universal parent relationship.Would it be good to add
SetParent/GetParenttoBoxprimitive and let methods likePages.AddPageset it?@rivo commented on GitHub (Jun 10, 2022):
References are top-down in
tviewonly for various reasons. (And maintaining both directions is a nightmare.) I don't see a parent relationship coming totviewany time soon. I thought we had solved your #662 issue. If there's still something open, we can work to find a solution.@abitrolly commented on GitHub (Jun 14, 2022):
@rivo yep, #662 is not solved, because there were no diagrams to explain how the event system works, what it is called
top-downand why app and root is at the top. Now that I've moved through the code, the main complain is that I don't want to hardcode widget references and shortcuts inside its parent widgets.I my head widgets form dynamic stack of windows, where top window on the screen is getting focus and can choose either to process a key, or to forward it down the stack. Again I think that the modal help screen that is invoked by F1 should be able to work from any place in app, and take a notion of current context. I was almost able to do it with pages, but such MRE is not there yet.
@rivo commented on GitHub (Nov 14, 2022):
From what I can tell, #662 was resolved. There were no further open questions. We can reopen it if you need help achieving some specific objective.
I understand that you have a different mental model of how a GUI library should be organized. Maybe this is coming from Qt/Pyside2 which you mentioned? I don't know. But
tviewis not designed in that way and it's unlikely that it will be completely restructured to fit a different architectural philosophy.If you have a specific problem, something that cannot be done at the moment, please describe it in detail so it can be reproduced, and I will give my best to provide a solution.
@abitrolly commented on GitHub (Nov 14, 2022):
Ok, the problem. I need a parent widget to forward shortcut to child widget if the child widget overrides this shortcut, without explicitly coding all child shortcuts into parent widget.
@rivo commented on GitHub (Nov 15, 2022):
This is a description of a general solution rather than a specific problem description. What I meant was for you to describe what the user does or wants to do in your application and how that can currently not be achieved. Maybe you want to include a screenshot, if that helps?
@abitrolly commented on GitHub (Nov 15, 2022):
The screenshot.
From here https://gitlab.com/abitrolly/dnf-go-gui
I want to show popup with package description if pressed
IorENTER. Help for the current widget if pressedF1.ESCto close current dialog.@abitrolly commented on GitHub (Nov 15, 2022):
Oh yea, I also want to display bottom bar with these shortcuts that should change depending on current dialog.
@rivo commented on GitHub (Nov 17, 2022):
Lots of ways to do this. Here's some example code. Adding the bottom bar is "left as an exercise to the reader". (Check out the presentation demo in the repo for ideas.)
@abitrolly commented on GitHub (Nov 17, 2022):
infoandhelpinformation should be popups with package listing always visible on the background. And in case ofhelppage forinfo,helpshould be rendered on top, so that when thehelpis discarded, theinfobecame active again. Also I don't want to hardcode return path frominfodialog intoupdatespage. Likeinfopage should know nothing about who called it. It should just receive parameter of what package to show.@rivo commented on GitHub (Nov 17, 2022):
Sure. Use
ShowPage()instead ofSwitchToPage()for the info page. This should also result in your other requirements asPagesis basically a deck of cards. If you hide the top card, the one below it will automatically become the top card again.I'm not going to code this for you. It's all there and it's all possible. You just need to dive into the code a little.
@abitrolly commented on GitHub (Nov 17, 2022):
Ok. I will try it.