Re: Subclassing TextBuffer
- From: "muppet" <scott asofyet org>
- To: gtk-perl-list gnome org
- Subject: Re: Subclassing TextBuffer
- Date: Mon, 16 Jun 2008 13:38:18 -0400 (EDT)
Daniel Gaston wrote:
print "Deleting Text!\n";
self -> signal_chain_from_overridden($start_iter, $end_iter);
^^
I think you mean
$self -> signal_chain_from_overridden($start_iter, $end_iter);
That would cause this:
However if I try and delete text in
the TextView I get an error, unable to load signal_chain_from_overridden
from package 'self'.
The -> operator will treat a bareword on the left side as a package name, so
you're effectively trying to call a class static method on the class "self".
Oops. Cryptic message for a typo, but there you go. :-)
$buffer -> insert_with_tags_by_name($buffer -> get_end_iter,
"$residue",
"$color")
When I try and do that I get the following warnings:
Gtk-WARNING **: Invalid text buffer iterator: either the iterator 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 across 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 at editor.pl line 295.
Gtk-CRITICAL **: gtk_text_buffer_apply_tag: assertion
`gtk_text_iter_get_buffer (end) == buffer' failed at editor.pl line 295.
Inserting Text!
Gtk2::TextIter=SCALAR(0xa66a158)
After it has gone through this for everything it needs to enter (each string
in an array) it loads the contents but without the colour tags.
Since the assertions failed, the relevant functions bailed out, so it's not
surprising that the rest works and you just don't have your color tags.
My guess is that the problem comes from not using the iterator passed to your
insert-text override; that's the only thing that looks out of the ordinary in
the code you posted. Why are you forcing it to get_end_iter(), anyway?
--
muppet <scott at asofyet dot org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]