RE: [gtk-list] GtkText - how to delete text completely
- From: Trog <trog gtk org>
- To: gtk-list redhat com
- Subject: RE: [gtk-list] GtkText - how to delete text completely
- Date: Fri, 15 May 1998 10:35:38 +0100 (BST)
On 15-May-98 Michael J. Hammel wrote:
> 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?
This is as proper as deleting text from a GtkText widget gets. I
think the widget reuses the memory allocated to the current buffer
rather than freeing it and reallocating it later.
> 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?
Well, there's the macro GTK_TEXT_INDEX(t, index) for getting the
character at position 'index'. Other than that, I think you can use
gtk_editable_get_chars to get a block of characters.
Tony
---
E-Mail: trog@gtk.org
Computers will not be perfected until they can compute how much more
than the estimate the job will cost.
Go Bezerk! http://www.gtk.org/~trog
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]