Re: getting the cursor location of a textbuffer
| From: | gell6 | Date: | Fri, 01 Sep 2006 11:27:25 +0000 |
| Subject: | Re: getting the cursor location of a textbuffer | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7193@lists.php.net to get a copy of this message | ||
ok finally got this working. Unless my version is the problem (i'm using
gnope 1.0), the problem seems to be that get_iter_at_mark doesn't return a
GtkTextIter as expected. So
$iter1 = $buffer -> get_iter_at_mark ($iter2, $mark);
doesn't put the new gtkTextIter into $iter1, it puts it into $iter2.
So the full code looks something like:
// get a gtkTextMark at the current cursor position
$mark = $buffer -> get_insert();
// generate a meaningless gtkTextIter because it can't be called directly
$iter2 = $buffer -> get_iter_at_line(0);
// Now $iter2 is changed to be at the cursor position. $iter1 is nothing.
$iter1 = $buffer->get_iter_at_mark($iter2, $mark);
$lineNumber = $iter2->get_line(); // yields the line number at which the
cursor is positioned.
--
View this message in context: http://www.nabble.com/getting-the-cursor-location-of-a-textbuffer-tf2184438.html#a6096954
Sent from the Php - GTK - General forum at Nabble.com.