gtk_editable_insert_text()




Hi, I am trying to understand better how this thing work, so if someone
can help me ...

when I try to handle myself the insert_text event of a GtkEntry, using a
handler like this (like the example from the documentation of
GtkEditable) :

//
insert_text_handler (GtkEditable *editable,
                     const gchar *text,
                     gint         length,
                     gint        *pos,
                     gpointer     data)
{

        gtk_signal_handler_block_by_func (GTK_OBJECT (editable),
                                    GTK_SIGNAL_FUNC (insert_text_handler),
                                    data);

        /* play with with text if I want to */

        gtk_editable_insert_text (editable, text, length, pos);

        gtk_signal_handler_unblock_by_func (GTK_OBJECT (editable),
                                    GTK_SIGNAL_FUNC (insert_text_handler),
                                    data);

}
//


I will get the expected result. But if I use an intermediary gint to hold
the value of "pos" the text will be inserted but he cursor wont move.

//
gint position;
position = *pos;
gtk_editable_insert_text (editable, text, length, &position);
//

So I understand that gtk_editable_insert_text() must get a pointer to this
int that is used to set the cursor position somewhere ahead and comes from?

But how come that I can call gtk_editable_insert_text() outside the
handler ( without blocking default handlers ) and it will work even if I
dont pass this 'special' handler ?

how can I call insert_text within my handler without using *pos ?

( In an application where I have no access to it - within a wrapper of
insert_text in pygtk ).

thanks.

--
Marcelo Corbani de Barros                   corbani async com br
Async Open Source Development - Brasil


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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