Sotiris
Sotiris

Reputation: 53

How to make a gtktextview drop to the next row when getting to the border of the window?

I want to make a textview that will output strings that may be multiple rows long, and to divide them when they reach the border of the window. The window is set to non-resizable, so its size is fixed.

I tried to get the column and row numbers and work with these, but each character has a different size in pixels, so while a row full of "m" characters would reach the end of the row with the tenth character, a row of "0" would need about sixteen characters to get to the end of the line.

Any ideas?

Upvotes: 0

Views: 122

Answers (1)

user4815162342
user4815162342

Reputation: 154866

It seems that you want to implement line wrapping in a GtkTextView. You don't need to do it yourself, the text view widget already supports line wrapping. To turn it on, call gtk_text_view_set_wrap_mode() with the text view and the appropriate wrap mode, such as GTK_WRAP_CHAR.

Upvotes: 1

Related Questions