mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[GH-ISSUE #194] List.GetRect() gives incorrect size #152
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#152
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 @delaneyj on GitHub (Nov 25, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/194
Shows
just quit: 0,0 15x10. It appears 15 width and 10 height are defaults of box object and don't match actual rendered size of box (in this case 2 for the height)@rivo commented on GitHub (Nov 26, 2018):
Yes, this is correct. When you call
tview.NewList(), the list is created with its default size. If you calllist.GetRect()immediately afterwards, as you do, you will receive that size.There are some functions which modify a primitive's size, for example
Application.SetRoot(list, true)or any of the layout classes (Flex,Grid). When you calllist.GetRect()after it was modified by these functions, you will get a different size and it should be the size that you see on screen.Let me know if this clarifies it.
@delaneyj commented on GitHub (Nov 26, 2018):
Well I'm using a List inside a Flex but the Rect is still 15x10. I would think when you add an item the
Rectwould get recalculated/updated. Basically when you add to a Flex you have to give it a height, and that height is wrong.@rivo commented on GitHub (Dec 3, 2018):
It gets updated when it's drawn, not when it's added. Because the actual screen size is known only at drawing time and most primitives such as
Flexdepend on the actual screen size. Thus, the final positions and sizes of primitives get calculated only when they are drawn.Maybe you want to let me know where this gives you problems so I can suggest a solution.
@rivo commented on GitHub (Dec 14, 2018):
Will reopen when there's new information that requires action.
@rivo commented on GitHub (Feb 16, 2022):
There was another comment here which I can't see anymore. Please comment/reopen/open a new issue if there's anything I should look at.