Re: Cursor position - Deletion of Text.



<gtk@uk2.net> writes:

> I'm rather new at GRK, and the tutorial is OK but I can't solve two
> problems with it:

Get the latest complete documentation as well.

> 1 - How do I get the cursor in a particular position: I have a pop up
>     window with a form, and the cursor has to be in a particular entry.
>     This has to be built in, no keyboard or mouse.

gtk_editable_set_position ()

void        gtk_editable_set_position       (GtkEditable *editable,
                                             gint position);

   Sets the cursor position.

   editable : a GtkEditable widget.      
   position : the position of the cursor. The cursor is displayed
   before the character with the given (base 0) index in the
   widget. The value must be less than or equal to the number of
   characters in the widget. A value of -1 indicates that the position
   should be set after the last character in the entry.  Note that
   this position is in characters, not in bytes.

> 2 - I have a GtkText that has some text in it that I got some way. I
>     need to press a button and have the text disappear and the widget be
>     ready to receive a new text. All this in the program, no human
>     intervention by keyboard or mouse.

gtk_editable_delete_text ()

void        gtk_editable_delete_text        (GtkEditable *editable,
                                             gint start_pos,
                                             gint end_pos);

   Delete a sequence of characters. The characters that are deleted
   are those characters at positions from start_pos up to, but not
   including end_pos. If end_pos is negative, then the the characters
   deleted will be those characters from start_pos to the end of the
   text.

   editable : a GtkEditable widget.
   start_pos : the starting position.
   end_pos : the end position.

[end quote]





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]