error in a GtkEditable



I want limit the lenght of the text to 5.
The code works fine ¿?, but the program shows in the console:

Gtk-CRITICAL **: file gtktext.c: line 879 (gtk_text_set_point):
assertion `index <= TEXT_LENGTH (text)' failed.
¿What happens?
This is the code:

void
on_text1_insert_text                   (GtkEditable     *editable,
                                        gchar           *new_text,
                                        gint            
new_text_length,
                                        gint            *position,
                                        gpointer         user_data)
{
gint a;

a=gtk_text_get_length(GTK_TEXT (editable));
if (a>5) {gtk_editable_delete_text(GTK_EDITABLE(editable), 5, 6);}
}

This function is called by a "insert_text" signal.

Thanks a million
Guillermo

 ___________________________________________________________________ 
Consigue tu e-mail gratuito TERRA.ES
 Haz clic en http://www.terra.es/correo/





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