mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 13:25:51 +03:00
[GH-ISSUE #52] An example of how to use Print or PrintSimple #39
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#39
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 @njones on GitHub (Feb 6, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/52
I'm trying to write some text into a
NewBox, and I can't figure out how to do this.The documentation explains how
Printis used to write to a box, but the function takes atcell.Screenwhich is an interface theBoxstruct doesn't conform to. Maybe, the example of how to create and use aBoxcan be expanded to include some text as well?@rivo commented on GitHub (Feb 7, 2018):
Hi,
Boxby itself doesn't allow you to write text into it. It's really just a box with a border and a title and it's used as the superclass for all other primitives.If you want to add text, you should use
TextView. BecauseTextViewimplements theio.Writerinterface, you can simply print to it:The
Print()functions in the package are used to write directly to atcell.Screenbut this is useful only if you decide to implement your ownPrimitivewhere you would implement theDraw()function. For most applications, this is probably not necessary.