mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #866] Drawing Primitives at any coords on the screen #629
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#629
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 @indeed999 on GitHub (Jul 31, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/866
Hi, is it possible to draw any Primitive at any given coords on the screen above the Grid which is set as root?
Fo example I want to draw
inputFieldabove themainGrid@rivo commented on GitHub (Apr 4, 2024):
@indeed999 As @digitallyserviced mentioned, you'll want to use
Pagesto put primitives on top of each other. And you can always callSetRect()to set a specific screen position. (IMO, it's not necessary to create your own primitive. If you simply want to display anInputField, place it into a "page" and call itsSetRect()function.)From a UI point of view, however, I would suggest not trying to calculate screen positions yourself but rather use
GridorFlexto position the element. For example, the following Wiki page shows how to center a primitive on a page:https://github.com/rivo/tview/wiki/Modal
This has the advantage that it will work with different screen sizes and you don't even have to know much about the screen yourself.