Widgets in widget
- From: AlannY <m alanny ru>
- To: gtk-app-devel-list gnome org
- Subject: Widgets in widget
- Date: Mon, 28 Apr 2008 18:31:03 +0400
Hi there.
I'm writing a custom widget. And I need to place some other widgets in
my widget. SO:
+-----------------------------+
| My custom widget |
| +-------------------------+ |
| | GtkVBox | |
| | +---------------------+ | |
| | | GtkButton | | |
| | +---------------------+ | |
| +-------------------------+ |
+-----------------------------+
I'm wring a _new() function like this (my widget is called "grid"):
GtkWidget*
grid_new ()
{
Grid *grid;
grid = gtk_type_new (grid_get_type ());
GtkWidget *widget = GTK_WIDGET (grid);
GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (widget), vbox);
return widget;
}
But, when running I get a message:
(grid-test:28016): GLib-GObject-WARNING **: invalid cast from `Grid' to
`GtkContainer'
(grid-test:28016): Gtk-CRITICAL **: gtk_container_add: assertion
`GTK_IS_CONTAINER (container)' failed
How to put widgets in my custom widget.
Thanks.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]