Re: [gtk-list] GtkText - how to delete text completely

"Michael J. Hammel" <> writes:

> The following code deletes text from the visible widget, but does not
> remove it from the "text" member of the GtkText data structure:
>    len = gtk_text_get_length(GTK_TEXT(textwidget));
>    gtk_text_set_point(GTK_TEXT(textwidget), 0);
>    gtk_text_forward_delete(GTK_TEXT(textwidget), len);
> Is this the proper way of deleteing all text from the text widget or is
> there some other routine that does this?  Do I need to manually free the
> storage in GtkText->text, along with updating the other relevent elements?
> One thing I noticed is that the GtkText->text structure member still points to
> the old data, and if you type in the text widget the characters you type
> overwrite the buffer starting at the beginning of the buffer.  It looks
> like the widget is cleared but either the buffer pointed to by
> GtkText->text is not freed or (at least) its not null terminated at the
> first byte.
> On a similar question:  I can get to the text by using GtkText->text, but
> is that the way I'm supposed to get to it?  Or is there a routine for
> accessing it opaquely?  I looked at all the routines in gtktext.c, but none
> seemed to fit the bill (or maybe my eyes were just glazing over - hard to
> tell, I've missed a lot of obvious stuff lately).


 My sticky-notes program uses this, the wmclass call and the raise
call. So you might want to have a look at it.

# James Antill --
* ^From: .*

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