Re: someone please answer, clearing text in a GtkTextView!



"Carl B. Constantine" <duckwing duckwing ca> writes:

> I have a GtkTextView in a window used for data entry into a database.
> The text typed in the view gets put in the database no problem, but once
> the data entry has occurred, I want to clear the view so that the next
> screen of data can be input.

Do you want to clear the *view* (the GtkTextView) or the *model* (the
GtkTextBuffer)?

If the former, you want to remove the TextBuffer and replace it with a
new one.

If the latter, you just need to clear the buffer.  Try something like:

textbuffer.erase(textbuffer.start(), textbuffer.end());

for Gtkmm, or else for GTK+ (untested), try

GtkTextIter start, end;
gtk_text_buffer_get_start_iter(textbuffer, &start);
gtk_text_buffer_get_end_iter(textbuffer, &end);
gtk_textbuffer_delete(textbuffer, &start, &end);

Both should have the same effect.


HTH,
Roger

-- 
Roger Leigh

                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.



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