someone please answer, clearing text in a GtkTextView!

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

 



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.

Looking through the API, there isn't a "set text" function for this view
(per se) like the GtkEntry widgets, except in the GtkTextBuffer. The
other funcition in that widget is gtk_text_buffer_delete, which I called
but I'm getting an error.

Here's the code I was using to get the buffer, then delete it:

/* the GtkTextView in this window requires a bit of extra work
     to get the text value stored in it.
  */
  
  specialView = lookup_widget(customers, "cust_instructions");
  specialBuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(specialView));
  gtk_text_buffer_get_bounds(specialBuffer, &start, &end);
  gtk_text_buffer_delete(specialBuffer, &start, &end);


But here's the error I'm getting when I try to do that:

(dispatcher:1523): Gtk-WARNING **: Invalid text buffer iterator: either the iter
ator is uninitialized, or the characters/pixbufs/widgets in the buffer have been
 modified since the iterator was created.
You must use marks, character numbers, or line numbers to preserve a position ac
ross buffer modifications.
You can apply tags and insert marks without invalidating your iterators,
but any mutation that affects 'indexable' buffer contents (contents that can be
referred to by character offset)
will invalidate all outstanding iterators
 
(dispatcher:1523): Gtk-CRITICAL **: file gtktextbuffer.c: line 1297 (gtk_text_bu
ffer_delete): assertion `gtk_text_iter_get_buffer (start) == buffer' failed

Then it segfaults.

So I tried the set text call like this:

gtk_text_buffer_set_text(specialBuffer,"", 0);

but that makes my app segfault as well.

Can anyone help?

-- 
 .''`.      Carl B. Constantine
: :' :     duckwing@xxxxxxxxxxx
`. `'    GnuPG: 135F FC30 7A02 B0EB 61DB  34E3 3AF1 DC6C 9F7A 3FF8
  `-  Debian GNU/Linux -- The power of freedom
  "Claiming that your operating system is the best in the world because more
  people use it is like saying McDonalds makes the best food in the world."
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux