Re: Widgets in widget
- From: Eduardo M KALINOWSKI <ekalin gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Widgets in widget
- Date: Mon, 28 Apr 2008 11:36:17 -0300
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
ekalin gmail com
http://move.to/hpkb
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]