Dynamically changing box content




Hi!

I've the following problem.
An application want's to display different contents in a {v,h}box,
depending on the selection of a combo entry. Right now i'm using a
notebook, but it looks rather ugly and is very irritating, becuase you 
can activate a notebook page, with totally irrelevant content.

I have 3 functions which return a vbox filled with widgets,
make_box1(), make_box2(), make box3(). The functionality should be as
follows:

parent = make_toplevel_widget();
box1 = make_box1();
box2 = make_box2();
box3 = make_box3();



switch (get_selection(combo_field))
{
  case ITEM_1:
    {
	display_in_toplevel(parent, box1);
	break;
    }
  case ITEM_2:
   {
       display_in_toplevel(parent, box2);
	break;
   }
....

how must the display_in_toplevel be programmed?
I think something along the lines:


   gtk_container_remove(parent->dynamic_box, current_box);
   gtk_widget_hide(current_box); /* Is this correct???????? */
   gtk_container_add(parent->dynamic_box, new_box);
   current_box = new_box;

Do i have to call widget_hide? How's geometry handled? Does the
parent resize (which i don't want)? I also don't want to call
gtk_widget_usize() on the dynamic boxes or the parent widget, because
this changes withe the fonts the user has selected in his gtkrc file.

Any suggestions?

--
Michael Lausch/g.a.m.s. edv dienstleistungen gmbh
See my web page <http://www.gams.net/~mla> or query PGP key server for PGP key.
"Reality is that which, when you stop believing in it, doesn't go away".
                -- Philip K. Dick



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