mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 13:25:51 +03:00
[GH-ISSUE #530] General Questions about TView #386
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#386
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 @syacko-sote on GitHub (Nov 18, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/530
Hello,
Thank you for addressing these questions:
Is it possible to have two or more tview.List on the screen at the same time. If so, how do you switch focus from one tview.List to another when using the arrow keys to navigate. An example might be a list of configuration options that have shortcuts, which when selected, a model form appears for input. The second tview.List has a list of DB tables that display info when selected.
Is there a way to set the min and max size of the screen for the Flex option?
Is it possible to have a Flex object inside another Flex object?
Is it possible to set the width / height of the screen when Flex is not used?
Can a tview.Table be added to a tview.TextView?
I have added a tview.Table to a tview.NewFlex(). Is there a way to reference the cells in the table, so they can be updated?
Thank you for your patience and again, I really like the tview package.
@tslocum commented on GitHub (Nov 26, 2020):
Hey @syacko-sote, I am not the maintainer of tview but I am glad to answer your questions.
Yes, any number of widgets may be displayed on the screen. Container widgets,such as
FlexandGrid, pass focus to the first contained widget with thefocusproperty set. When multiple widgets havefocusset, only the first receives focus. To switch focus you must manage the focus state for the application. You can do this by capturing user input viaSetInputCaptureand listening forTabandShift+Tabkey events. I created FocusManager (code) to make this process less cumbersome.Flex.AddItemtakes the argumentfixedSizewhich may be used to set the maximum size of the item on the screen.Yes, widgets do not have any nesting limitations that I am aware of.
You can set the width and height of a widget in several ways. If it is the only widget on the screen, you could directly set its width and height via
SetRect. However the best way, at least in my opinion, is to use aGridviaSetRowsandSetColumns, because it can be adapted more easily as the application evolves and more widgets are added.TextViewis a text display widget, it does not allow other widgets to be added to it. If you are looking to use multipleTextViews in a tabular fashion, use aGrid. Let me know if you meant something else.Yes,
Table.GetCellreturns a reference to the a cell in the table, which you can manipulate. Just be sure to callApp.Drawafter making changes.@syacko-sote commented on GitHub (Dec 1, 2020):
Thank you so much for your feedback. Hopefully, this will help others new to tview.