Re: Signal when the cursor of a GtkTextView is changed
- From: "A. Pagaltzis" <pagaltzis gmx de>
- To: gtk-perl mailing list <gtk-perl-list gnome org>
- Subject: Re: Signal when the cursor of a GtkTextView is changed
- Date: Thu, 19 Jan 2006 08:36:52 +0100
Hi Eduardo,
* Eduardo M KALINOWSKI <ekalin bol com br> [2006-01-18 22:40]:
But I could not find a way to do that.
The Text Widget Overview document in the docs says this:
You can think of a mark as an invisible cursor or insertion
point; it floats in the buffer, saving a position. [â] Like
tags, marks can be either named or anonymous. There are two
marks built-in to GtkTextBuffer; these are named "insert" and
"selection_bound" and refer to the insertion point and the
boundary of the selection which is not the insertion point,
respectively. If no text is selected, these two marks will be
in the same position. You can manipulate what is selected and
where the cursor appears by moving these marks around. [2]
There is a "move-cursor" signal in GtkTextView, but the docs say
that one should not connect to it. Is there a way to catch
cursor movements in a signal?
Having read the documentation, we find that what you probably
need to do is find a signal which lets you know about changes to
the named mark `insert` in the TextBuffer that your TextView is
connected to.
The documentation for TextBuffer lists a signal `mark-set`.
Sounds promising, so letâs try it:
$buffer->signal_connect( mark_set => sub {
my ( $buffer, $iter, $mark ) = @_;
warn if $mark->get_name eq 'insert';
} );
And what would you know â this produces a warning whenever the
cursor is moved.
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]