Hello,
I understand that GtkDialog has been deprecated.
It had a function
GtkWidget* gtk_dialog_get_content_area(GtkDialog* dialog)
that I used to retrieve the GtkBox to add child widgets to.
When I replace the GtkDialog with a GtkWindow as:
<object class="GtkWindow" id="gtk_window_1"><style><class name="gtk_window_1"></class></style>
<child>
<object class="GtkGrid" id="gtk_grid_18">
</object>
</child>
</object>
and
void gtk_window_1_on_realize (GtkWidget* gtk_window_1, gpointer user_data)
{
gtk_grid_18 = gtk_builder_get_object(gtk_builder_0, "gtk_grid_18");
}
I have a GtkGrid similar to the GtkBox. It can be used to add child widgets.
When I replace the GtkDialog with a GtkWindow as:
<object class="GtkWindow" id="gtk_window_1"><style><class name="gtk_window_1"></class></style>
</object>
void gtk_window_1_on_realize (GtkWidget* gtk_window_1, gpointer user_data)
{
gtk_grid_18 = gtk_grid_new();
gtk_widget_set_parent(GTK_WIDGET(gtk_grid_18), gtk_window_1);
}
I get the following error:
Trying to snapshot GtkGrid 0x… without a current allocation
When looking at the variables that I consider relevant in connection to this allocation, I get for both methods exactly the same width, height and baseline.
gtk_window_1 : 0000000000E93E60
gtk_window_1 parent : 0000000000000000
gtk_window_1 layout : 0000000000000000
gtk_window_1 width : 0
gtk_window_1 height : 0
gtk_window_1 baseline: -1
gtk_grid_18 : 0000000001B36FC0
gtk_grid_18 parent : 0000000000E93E60
gtk_grid_18 layout : 0000000001B370A0
gtk_grid_18 width : 0
gtk_grid_18 height : 0
gtk_grid_18 baseline: -1
Can someone please tell me what I’m doing wrong?
Best regards,
Mischa Baars, The Netherlands.