Re: Gtk Container add
- From: Victor Vicente <drzoidberg wanadoo es>
- To: exilion yifan net
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Gtk Container add
- Date: Wed, 17 Jul 2002 23:13:03 +0200
If you want to create an app with three buttons, that contains a pixmap every
one, you must do something like this
main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
box = gtk_hbox_new (FALSE, 0);
for (i=0; i<NUM_BUTTONS; i++)
{
button[i] = gtk_button_new ();
pixmap[i] = gtk_pixmap_new (pixmap, mask);
gtk_container_add (GTK_CONTAINER (button[i]), pixmap[i]);
gtk_box_pack_start (GTK_BOX (box), button[i], FALSE, FALSE, 0);
}
gtk_container_add (GTK_CONTAINER (main_window), box);
gtk_widget_show_all (main_window);
In your example, I think you're using the same variable for all the buttons,
and you've to declare a variable for each one.
Im creating an app with 3 buttons.. and each button will show something.
Each button have a pixmap (created it with gimp) and I have a window
(with TOP_LEVEL), also I add a box to this window (with a
gtk_container_add). The problem starts when I add the image to the
button:
image = gtk_pixmap_new(pixmap, mask);
gtk_widget_show (image);
gtk_container_add(GTK_CONTAINER (button), image);
When I create a second gtk_Container_add, I get this:
Gtk-CRITICAL **: file gtkbin.c: line 217 (gtk_bin_add): assertion
`bin->child == NULL' failed.
How could I solve this?.. killing the other container, or what?.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]