Set Position in EditorGadget

Linux specific forum
Pinhead
User
User
Posts: 47
Joined: Fri Sep 09, 2005 11:24 pm

Set Position in EditorGadget

Post by Pinhead »

I know with CountGadgetItems() I can get the Number of rows of my Editorgadget.
But how can I set the Cursor after the last Character? I find the GTK-Signal
move_to_row. How can i send this signal?
Can anyone send the code?

TIA
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Do you want to put it after the last character of a specific line, or just at the end of the gadget ?

There is the gtk_editable_set_position_() command. If you want to set the cursor
after a specific line, you have to get the whole text into a buffer, scan through
it to get the actual character index of where you want to put the cursor and then
call the above function.

Putting the cursor at the end of everything is simpler. A PB EditorGadget is
both a GtkEditable and a GtkText (because GtkText is an extension of GtkEditable),
so you can mix both types of functions.
So it can be done like this:

Code: Select all

GadgetID = GadgetID(#Editor)
length = gtk_text_get_length_(GadgetID)
gtk_editable_set_position_(GadgetID, length)
quidquid Latine dictum sit altum videtur
Pinhead
User
User
Posts: 47
Joined: Fri Sep 09, 2005 11:24 pm

Post by Pinhead »

This work very fine!
Where can I find a Doc about such functions?
At gnome.developer.org didn't find 'gtk_text_get_length'

Thank you very much!!!!
Post Reply