Re: Gtk-WARNING **: invalid cast from `(unknown)' to `GtkEditable'



On Thursday 04 April 2002 12:58 pm, Ian Frawley wrote:

Cricky sussed it myself. I was calling the procedure that initialises the 
widgets twice hooray.

Thanks Me :oP

Hi yall

I keep getting the following errors:

Gtk-WARNING **: invalid cast from `(unknown)' to `GtkEditable'

Gtk-CRITICAL **: file gtkeditable.c: line 489 (gtk_editable_get_chars):
assertion `GTK_IS_EDITABLE (editable)' failed.

***********************************************************
Here's my code 'l' is a structure that holds all my widgets BTW:


****** Creating Widget bit *********
GtkWidget * tmptable = gtk_table_new(20,20,TRUE);
GtkWidget * RecordTable = gtk_table_new(1,2,FALSE);

l->ServiceRecord = gtk_text_new(NULL, NULL);
gtk_text_set_editable (GTK_TEXT (l->ServiceRecord), TRUE);
gtk_table_attach_defaults(GTK_TABLE(RecordTable) , l->ServiceRecord , 0 , 1
, 0 , 1 );
GtkWidget * Vertical = gtk_vscrollbar_new ( GTK_TEXT ( l->ServiceRecord
)->vadj);
gtk_table_attach_defaults(GTK_TABLE(RecordTable) , Vertical , 1 , 2 , 0 , 1
);

gtk_table_attach_defaults(GTK_TABLE(tmptable) , RecordTable , 0 , 20 , 0 ,
20 );

GtkWidget * RecordFrame = gtk_frame_new("Record");
gtk_container_add(GTK_CONTAINER(RecordFrame), tmptable);

blah blah blah

GtkWidget * AddObjectButton = gtk_button_new_with_label("Add Translation
List");

blah blah

gtk_signal_connect (GTK_OBJECT (AddObjectButton), "clicked",
                    GTK_SIGNAL_FUNC ( AddServiceRecord ),
                    l);

*****Code in callback*****
void AddServiceRecord(GtkWidget * button, Lists * data)
{
gchar * Record = gtk_editable_get_chars (GTK_EDITABLE(data->ServiceRecord),
0 , -1);

if(Record != NULL){
  cout << Record << endl;
  g_free(Record);
}
else
  cout << "Empty\n";
}

I can't see any problems with it so any help would be well apreciated.

Many Thanks


Ian (Freebasing on boredom.........)



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