AlannY wrote:
> 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.
>   

Is your "Grid" widget derived from GtkContainer?

-- 
It is through symbols that man consciously or unconsciously lives, works
and has his being.
                -- Thomas Carlyle

Eduardo M KALINOWSKI
[EMAIL PROTECTED]
http://move.to/hpkb

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to