Re: Gtk::TextView



On Fri, Nov 08, 2002 at 04:58:52PM -0800, Loban Amaan Rahman wrote:
> The documentation for GtkTextView has me all muddled. How do I do the
> following tasks:

Note that questions about using gtk should go to gtk-list or
gtk-app-devel-list, rather than gtk-devel-list.

> 
> (1) Append text to the end of the text buffer. This could be in 1 step
> or if not possible, the following two steps:
> 	(a) Move cursor to end of buffer
> 	(b) Insert text

GtkTextIter iter;

gtk_text_buffer_get_end_iter (buffer, &iter);
gtk_text_buffer_insert (buffer, &iter, "Hello", -1);

> (2) Scroll the text view so the latest text (at end) can be seen

to scroll the cursor onscreen do
gtk_text_view_scroll_mark_onscreen (textview, 
                                    gtk_text_buffer_get_insert (buffer));

> (3) Insert text with markup (like <b>)

Has to be done manually (manually add tags). There's a bug in bugzilla
discussing adding markup support.

> (4) Specify that the text should be in a monotype font. (Could use (3)).

gtk_widget_modify_font() on the text view is the easiest thing for
affecting the whole widget.

Havoc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]