[GH-ISSUE #655] Hi #479

Closed
opened 2026-03-04 01:05:21 +03:00 by kerem · 7 comments
Owner

Originally created by @0x41337 on GitHub (Sep 24, 2021).
Original GitHub issue: https://github.com/rivo/tview/issues/655

hello how could i write on the box? I know there is: primitive but I found it a bit complex, I just want to write inside the box, something like:
+-----Box Name-----+
my name: name
+------------------------+

I'm starting to study this lib

Originally created by @0x41337 on GitHub (Sep 24, 2021). Original GitHub issue: https://github.com/rivo/tview/issues/655 hello how could i write on the box? I know there is: [primitive](https://github.com/rivo/tview/wiki/Primitives#hooking-into-a-primitives-draw-function) but I found it a bit complex, I just want to write inside the box, something like: +-----Box Name-----+ my name: name +------------------------+ I'm starting to study this lib
kerem closed this issue 2026-03-04 01:05:21 +03:00
Author
Owner

@0x41337 commented on GitHub (Sep 24, 2021):

hey, @rivo help

<!-- gh-comment-id:926798632 --> @0x41337 commented on GitHub (Sep 24, 2021): hey, @rivo help
Author
Owner

@rivo commented on GitHub (Sep 24, 2021):

@gh-ninja Box is just the superclass for all other primitives. In most cases, you don't need to use it directly. (Only if you really just want to display an empty box.)

If you want to write something inside the box, use TextView.

Let me know if this helps.

<!-- gh-comment-id:926809095 --> @rivo commented on GitHub (Sep 24, 2021): @gh-ninja `Box` is just the superclass for all other primitives. In most cases, you don't need to use it directly. (Only if you really just want to display an empty box.) If you want to write something inside the box, use `TextView`. Let me know if this helps.
Author
Owner

@0x41337 commented on GitHub (Sep 24, 2021):

@rivo ok but how could i use TextView to create? Sorry, I'm still learning...

<!-- gh-comment-id:926823827 --> @0x41337 commented on GitHub (Sep 24, 2021): @rivo ok but how could i use `TextView` to create? Sorry, I'm still learning...
Author
Owner

@rivo commented on GitHub (Sep 24, 2021):

Check out the demos/textview directory for examples. You can call the SetText() function to set your text or use the io.Writer interface to write to it.

<!-- gh-comment-id:926828699 --> @rivo commented on GitHub (Sep 24, 2021): Check out the `demos/textview` directory for examples. You can call the `SetText()` function to set your text or use the `io.Writer` interface to write to it.
Author
Owner

@0x41337 commented on GitHub (Sep 24, 2021):

Aaaaaa, it worked, thank you so much @rivo you are a best dude

My Code:

func main() {
	app := tview.NewApplication()
	textView := tview.NewTextView()
	textView.SetBorder(true)
	textView.SetTitle("box name")
	textView.SetText("hi, im cool box ^^")
	app.SetRoot(textView, true).EnableMouse(true).Run()
}

Do you have any social networks? like Telegram, so if I have any questions, I'll get in touch with you there, so you don't have to open the issue for a question.

<!-- gh-comment-id:926836768 --> @0x41337 commented on GitHub (Sep 24, 2021): Aaaaaa, it worked, thank you so much @rivo you are a best dude My Code: ``` func main() { app := tview.NewApplication() textView := tview.NewTextView() textView.SetBorder(true) textView.SetTitle("box name") textView.SetText("hi, im cool box ^^") app.SetRoot(textView, true).EnableMouse(true).Run() } ``` Do you have any social networks? like Telegram, so if I have any questions, I'll get in touch with you there, so you don't have to open the issue for a question.
Author
Owner

@rivo commented on GitHub (Sep 24, 2021):

It's fine to open issues here. I might not respond right away like today but maybe others can help you, too.

<!-- gh-comment-id:926893902 --> @rivo commented on GitHub (Sep 24, 2021): It's fine to open issues here. I might not respond right away like today but maybe others can help you, too.
Author
Owner

@0x41337 commented on GitHub (Sep 24, 2021):

It's fine to open issues here. I might not respond right away like today but maybe others can help you, too.

okay, thanks ! 😁

<!-- gh-comment-id:926894767 --> @0x41337 commented on GitHub (Sep 24, 2021): > It's fine to open issues here. I might not respond right away like today but maybe others can help you, too. okay, thanks ! 😁
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#479
No description provided.