mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 13:25:51 +03:00
[GH-ISSUE #86] Feature: Global Menu Primitive #64
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#64
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 @muesli on GitHub (Mar 24, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/86
I've started working on a little Menu primitive, which I seem to need rather often in my apps. I'm wondering if it's a common enough feature, that would warrant integrating something like it directly in tview.
This would allow for a tighter integration with
tview.Application, the fullscreen layout/screen and global shortcuts.Link to my (still bare-bone) implementation: https://github.com/muesli/service-tools/blob/master/service-monitor/menu.go
@rivo commented on GitHub (Mar 25, 2018):
Originally, the
Listprimitive was implemented as a kind of menu. That's why it has shortcuts to select list items. Unless you're adding sub-menus etc., I don't see the difference between this and aListyet.@muesli commented on GitHub (Mar 25, 2018):
But that doesn't feature global shortcuts and is usually a focusable UI component you control with your cursor keys. Have you checked out my example? Is this something you can achieve with List as well?
A live thingy I use this Primitive in would be: https://github.com/muesli/service-tools/tree/master/service-monitor
@rivo commented on GitHub (Mar 26, 2018):
I just had a brief look at the code. Didn't realize it installs a global key listener.
This use case is exactly what
app.SetInputCapture()is for. I use it in the presentation demo, too. You could use that to callSetCurrentItem()on aList. I update aTextViewcomponent with it. I guess everybody has a different idea of what such a menu could look like.It's conceivable to extend the
Listprimitive to draw the list items horizontally. But it doesn't feel right to introduce a primitive that has global effects, potentially conflicting ones with other primitives.