Re: Position of cursor
| From: | Scott Mattocks | Date: | Thu, 27 Oct 2005 14:47:35 +0000 |
| Subject: | Re: Position of cursor | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-6299@lists.php.net to get a copy of this message | ||
Jp was on the right track with getting the mark. Unfortunately I don't think there is a quicker way than this:
1) Get the mark
$mark = $buffer->get_insert();
2) Get the iter at the mark
$iter = $buffer->get_iter_at_mark($mark);
3) Get the offset (position) at the iter
$offset = $iter->get_offset();
Of course you could turn this into one big line but readability suffers
$offset = $buffer->get_iter_at_mark($buffer->get_insert())->get_offset();
Scott
Ivan Rodriguez wrote:
Thanks but this is incorrect, get_insert() returns GtkTextMark and not an integer what i need :( On 10/27/05, Jp <jp@jp-corner.uni.cc> wrote:-- Scott Mattocks scott@crisscott.com http://www.crisscott.com http://pear.php.net/user/scottmattocksIvan Rodriguez escreveu:Hi It's posible to get the position of cursor in GtkTextBuffer, for exampleifI have this text: This is the |text the cursor is de |, can I get the position? in this case the position is12ThanksHum, if I had to take a guess, I'd say GtkTextBuffer::get_insert()