Re: Get current cursor position?
| From: | Scott Mattocks | Date: | Sun, 09 Apr 2006 12:58:11 +0000 |
| Subject: | Re: Get current cursor position? | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-6853@lists.php.net to get a copy of this message | ||
Hi Sean,
I know Steph already helped you out but here is a little extra info that might make things easier.
If you want to just insert text at the current cursor position, you can use GtkTextBuffer::insert_at_cursor(). All that method takes is the text you want to insert.
Also, to get an iter at a mark you can use, GtkTextBuffer::get_iter_at_mark(). You can use this with GtkTextBuffer::get_insert() to get the iter at the cursor.
Finally, if you just want to get the iter at the end of the buffer to append text to it, you can use GtkTreeBuffer::get_end_iter.
Hope that helps.
Scott
Sean Coates wrote:
Steph Fox wrote:Hi Sean, and welcome to PHP-GTK corner. I didn't know the answer to this one either, I just spent forever playing. It looks like $iter->get_offset() is the baby - the 'offset' part refers to the position in the text buffer (aka the whole thing). It's easy enough to initialize the iter. What you _can't_ do is insert text on the fly programmatically though, as far as I can work out. GTK+ gets upset about it.Hi Steph, aha! So, mark-set delivers an iterator. This is exactly what I wanted; thanks! S