-
-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: popup/docked menu #104
Comments
I do something similar here: https://github.com/muesli/service-tools/blob/master/service-monitor/servicescmd.go#L90 (grep for loglevel). |
@muesli Thanks. I did have a look of the code when you raise an issue previously, but it looks like it's tool running in linux, is it? Is it possible you could grab a animation gif to show how your menu works? or a quick screen capture video? |
@muesli I managed to get it run in a debian box. It's impressive. It works, in a way exactly as what I detailed as solution A, and as I mentioned, due to a tview's current implementation, the popup is not a popup window. It shield the foreground view of current window with the entire active page. This also brings a unacceptable bad experience of redraw the whole screen in remote ssh. Even in my local vagrant box, the refresh of the full page is terrible slow. Also the implementation code will be too not elegant due to lack of such support with a new widget to make top most modal window with a list. I do like the popup search input, it's a good pattern I will adopt. Thanks |
I was considering a way for simplest support for the docked solution (B)
In this way, take the demo-> presentation -> table code for example: User could trigger a key, eg: m to show the list menu, after execution of the method, it hide the list menu again. Just a thought |
Can we back up a little bit? I have some trouble understanding what you are trying to achieve in the first place. (And I'm sorry but I don't have the time to build and try out applications to figure it out.) Would it be possible for you to send me a screenshot of what you need with a bit more explanation? (I can think of all kinds of "popup menus". I'm not sure what exactly you're referring to.) Thanks! |
This is what I mean for the solution B:
The request is not really to need you to dev the app, but the capability for user to be able to do it Let me know if you need more info |
This is the idea for the solution A:
|
Thanks for the screenshots. Let's talk about (B) first: Here, the menu is part of a Regarding (A), I understand that there are some limitations to achieving this:
I am planning to let you add In any case, however, I don't see a way around using the |
@rivo Thanks for the idea. Yes, I could make it work using a flex to be removed and re-added to parent flex in sequence of all other items with same parent flex. I guess to add a SetVisible would definitely make these tedious process smoother. Some fake code:
By doing above, sol B could be achieved. I also got the idea of nil element could be used for a place holder to be not drawn. However I am not sure what use case could be. It could only be used as parameter in AddItem, but can not be defined as a variable, hence be referenced. I am guessing that what you mentioned for (A) seems to indirectly route back to sol B, am I right? I don't get it what you mean I could make the list centered, or could you elaborate it a little more? |
I think I have got your idea of using nil, it works but not perfect. for example: If I call the popup menu, it will show: I used two nil element above flex5 and below flex5, they are just two place holders. The problem of it is that it still hide the content area: box3. I have no idea how the nil element area could help with that. Basically flex2 is the dad of box3 and flex3, you will have to swap to show one or another. Am I missing anything from you idea? is there any way that in this demo, I could still see the content area but the popup appear to be above box3? |
@rivo closing this for now. There could be a nice to have exported function but it's all right that I could manage it in my end. Thanks |
Apologies for replying so late. I was very busy in the last few days so I couldn't reply any sooner. The I put an example in the Wiki: https://github.com/rivo/tview/wiki/Modal Regarding a "visible" flag, I haven't added it yet. If it's really needed, I would probably do something different, for example But if you're ok, I'll leave it the way it is for now. |
Thanks. Your new update works straight away in my demo code. However, it appears that it brought a bug in: the flex I used won't come with border and title. Is this a cost comes with the change, if so I am fine and accept that. I only use a debug toggle to explicitly show the border and title in development env to understand the layout structure. If this is a bug, then you might need to fix it in grid too. Adding a SetItemSize would be definitely very useful and make tview visually more dynamic, fun to use and easy to add more client features. I (as a user) could implement my way for it, it's just a little repetitive to do same thing for multiple tview components. Again, it is a very useful thing to nice to have as builtin. I will leave the decision to you if you think it could benefit many others and also you have some time for it. Thank you again. It's really nice work. |
Something to add on as I just spent sometime to verified, the two modal examples using pages are not entirely 'correct' as the page will overwrite each other eventually if you switch one of them on. My way of doing it is to use flex(or grid[easier]) as layout parent and manage removing all of them and add only required. This is where the visible function needed. |
I'm sorry but I have trouble following your explanations. It may just be a language issue so let me address what I do think I understood:
It never did. I haven't made any changes to this part. In fact, none of the primitives come with border and title. If you want it, you have to switch it on explicitly using
The point of the |
@rivo for the bug, this is what I meant: The version I used is as below, which introduced "clearing of flex and grid back ground":
With this version, even with SetBorder(true) and SetTitle("whatever"), it will not draw the border and display the title. With previous version, it did render them correctly, that's what I mean the bug is. The code:
The screen: This is one version earlier before the change 213c37c |
Right. Sorry for my cluelessness. ;-) I fixed this. I had wanted to reintroduce it while I fixed the other part but forgot. It's fixed now. |
Thanks very much for fixing it |
I'm interested in the |
The reason I am asking for popup menu is that the list using as menu taking too much space if laid vertically, it just doesn't look proper as a habit if laid horizontally.
Two solutions:
I tried current modal, it seems the way of using it is too much mind twisted. I don't like it for a few reasons:
User need to put it into a page, then hide it, you will have to switch to that page in order to show it. This way, the whole page of modal normally hide the view of your working page. It is not a popup, at least the way using it does not feel intuitive
This modal page is taking a tab page and it is not naturally belongs to the tab pages. If I need one modal window as menu for a tab page for some operations, there would be too many pages used for the modal windows. To avoid displaying the modal window page, when I render the tab number and switch logic, I will have to put special logic for it
Not sure if this is good. But if it's doable and easy to implement, then it should be cool
Allow a triggering key(eg: m for menu) from current focused gui component, eg: page/table/textview etc to trigger the popup modal
For a tab page structured as: flex [(hidden list) | table]. The hidden list won't be showing and take any space. Only when the triggering key is pressed, then the list will be showing and take the space, the table component will take the space as normal. After user select the list item to trigger required function, the list will be hidden again.
Just a thought for your consideration. tview will get better and even cooler :)
The text was updated successfully, but these errors were encountered: