My application uses Builder to create a user interface, and I don’t know how to get a GtkWidget pointer to a TextView widget in the ui file. The method gtk_builder_get_object will return a GObject pointer, but the method gtk_text_view_get_buffer won’t accept this type of pointer. I’m trying to get the TextView to display the contents of a text file.
You just need to cast:
GtkWidget *widget = GTK_WIDGET (object);
Or if you’re sure it’s a
GtkWidget, you can use:
GtkWidget *widget = (GtkWidget *)object;
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.