Re: GtkText & GtkTextView

> From: Filipe Bonjour <bonjour ime unicamp br>
> Dear All,
> I have a question about GtkText. I know that it's deprecated, but at
> work I have RH 6.2, which comes with GTK+ 1.2.6-7, which doesn't support
> GtkTextView. Now, I'm leaving my present job in two months and I'm
> somewhat reluctant to upgrade my system at this point, so I apologize in
> advance but I'd like to ask a question about GtkText...
> What is the best (i.e. fastest) way to clear GtkText? For the moment I
> am using
>   gtk_text_set_point(GTK_TEXT(widget), 0);
>   gtk_text_forward_delete(GTK_TEXT(widget), (guint)
> 			  gtk_text_get_length(GTK_TEXT(widget)));
> but cleaning the window this way when I move the window takes a
> noteceable amount of time, even though the program outputs only about
> 15-20 lines of text into it. I was thinking about doing something like
>   gdk_window_clear(GTK_WIDGET(widget)->window);
>   gtk_text_set_point(GTK_TEXT(widget), 0);
> which I was hoping would be faster. But then I guess I should get into
> the details of the GtkText structure to set the length of the text to
> zero. But then I'd probably have to free the memory allocated for the
> old text. That's a lot of trouble for a small result, considering that
> my next program will use GtkTextView...
> So, is there an easy way?

gtk_editable_delete_text (GtkText "is-a" GtkEditable)

passing 0 and -1 as the position parameters.

It works for me in Python so I assume it works in C.


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