Re: Position of cursor

From: Date: Thu, 27 Oct 2005 19:11:53 +0000
Subject: Re: Position of cursor
References: 1 2 3 4  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-6305@lists.php.net to get a copy of this message
Thanks Scott On 10/27/05, Scott Mattocks <scott@crisscott.com> wrote: > > 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: > >> Ivan Rodriguez escreveu: > >>> Hi > >>> > >>> It's posible to get the position of cursor in GtkTextBuffer, for > example > >> if > >>> I have this text: > >>> > >>> This is the |text > >>> > >>> the cursor is de |, can I get the position? in this case the position > is > >> 12 > >>> Thanks > >>> > >> Hum, if I had to take a guess, I'd say GtkTextBuffer::get_insert() > >> > > > > -- > Scott Mattocks > scott@crisscott.com > http://www.crisscott.com > http://pear.php.net/user/scottmattocks >

« previous php.gtk.general (#6305) next »