Switching pixmaps in Gtk_VBox?





I would like advice on how to do the following. I'm using Gtk-- 1.0.1.

Stack 6 pixmaps into a Gtk_VBox.
Switch the pixmap displayed in each of the 6 positions.


Here is what I have tried.

// 6 hboxes holding pixmaps are packed into a vbox.
...
  softkey_vbox = new Gtk_VBox(true,0);
  softkey_vbox->set_usize(80,80);
  top_packer->add (*softkey_vbox,
		   GTK_SIDE_RIGHT,
		   GTK_ANCHOR_NORTH_EAST,
		   (GtkPackerOptions)(GTK_FILL_Y|GTK_FILL_Y),
		   0, //border
		   0, //pad_x
		   0, //pad_y
		   0, //i_pad_x
		   0 //i_pad_y
		   );

  key_box_1 = new Gtk_HBox();
  pm_1a = new Gtk_Pixmap(*this, small_xpm);
  pm_1b = new Gtk_Pixmap(*this, one_xpm);
  key_box_1->add(pm_1b);
  pm_in_1 = pm_1b;
  softkey_vbox->pack_start (*key_box_1,
			    true, //expand
			    true, //fill
			    0 //padding
			    );
  pm_2a = new Gtk_Pixmap(*this, small_xpm);
  pm_2b = new Gtk_Pixmap(*this, one_xpm);
  softkey_vbox->pack_start (*pm_2a,
			    true, //expand
			    true, //fill
			    0 //padding
			    );
... repeated 4 more times

// attempt to switch
      key_box_1->remove(pm_1b);
      key_box_1->add(pm_1a);
// blank instead of pm_1a image

// attempt to switch
      key_box_1->remove(pm_1a);
      key_box_1->add(pm_1b);
// pm_1b image is displayed

Thanks.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]