Re: GtkTextView->get_iter_at_location bug or user error?
- From: muppet <scott asofyet org>
- To: "Beanz" <gtk-perl beanz uklinux net>
- Cc: gtk-perl-list gnome org
- Subject: Re: GtkTextView->get_iter_at_location bug or user error?
- Date: Thu, 31 Jul 2003 02:42:36 -0400
On Wednesday, July 30, 2003, at 05:27 PM, Beanz wrote:
Usage: Gtk2::TextView::get_iter_at_location(text_view, iter, x, y)
at ...
i played around with it a bit, and with the minor fix i just committed
to cvs, this code:
$view1->signal_connect (button_release_event => sub {
my ($textview, $event) = @_;
my @coords = $textview->window_to_buffer_coords ('text',
$event->coords);
my $iter = $textview->get_iter_at_location (@coords);
$iter->backward_word_starts (1);
$iter_end = $iter->copy;
$iter_end->forward_word_ends (1);
print "clicked on '"
. $textview->get_buffer->get_text ($iter, $iter_end, 1)
. "'\n";
0
});
prints out the word you clicked on. quite cool. note the important
call to window_to_buffer_coords --- without that, it always thinks
you're scrolled to the top.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]