Pb in writing a widget !
- From: jflecomte idealx com (Lecomte Jean François)
- To: gtk-app-devel-list gnome org
- Subject: Pb in writing a widget !
- Date: 20 Mar 2001 18:38:36 +0100
Hi there,
I'm tring to write a widget gtk_tag which should derivate from a vbox
struct _GtkTag
{
GtkVBox vbox;
GtkWidget *title;
GtkWidget *drawing_extent;
};
and should look like:
-------------------------------------
| | LABEL |
| | |
| DA --------------------------------
| | VBOX |
| | |
-------------------------------------
where DA is some drawing area
In fact, i want a vbox with some decorations around it.
then i want to be able to write
gtk_box_pack_start (GTK_BOX (tag_widget), any_widget, FALSE, FALSE, 0);
where tag_widget is one instance of the new created widget.
But i have some pbs...
in the gtk_tag_init function ,
static void
gtk_tag_init (GtkTag *tag)
{
GtkWidget *hbox1;
GtkWidget *vbox1;
GTK_WIDGET_SET_FLAGS (tag, GTK_NO_WINDOW);
hbox1 = gtk_hbox_new (FALSE, 0);
gtk_widget_show(hbox1);
tag->drawing_extent = gtk_drawing_area_new ();
gtk_widget_show(tag->drawing_extent);
gtk_box_pack_start (GTK_BOX (hbox1), tag->drawing_extent, TRUE, TRUE, 0);
gtk_widget_set_usize (tag->drawing_extent, 100, -2);
vbox1 = gtk_vbox_new (FALSE, 0);
gtk_widget_show(vbox1);
gtk_box_pack_start (GTK_BOX (hbox1), vbox1, TRUE, TRUE, 0);
tag->title = gtk_label_new (_("Youhou"));
gtk_widget_show(tag->title);
gtk_box_pack_start (GTK_BOX (vbox1), tag->title, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox1), GTK_WIDGET(tag), TRUE, TRUE, 0);
}
the last line produce a
Gtk-CRITICAL **: file gtkcontainer.c: line 715 (gtk_container_add)
: assertion `widget->parent == NULL' failed.
And then i'm unable to cast my gtk_tag in gtk_box !
Could someone tell me how do i have to do this
or give me some pointer of such widgets...
thanks.
--
--
J-François LECOMTE IDEALX S.A.S.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]