Re: problem with status bar



Luiz Rafael Culik Guimaraes wrote:
> so the pack should be in this order
>
> vbox = gtk_vbox_new (FALSE, 0);
>   gtk_container_add (GTK_CONTAINER(hWnd), vbox);
>   if (bStatus)
>   {
>   statusbar = gtk_statusbar_new();
>  box = (GtkFixed*)gtk_fixed_new();
>
> gtk_box_pack_start( GTK_BOX (vbox), (GtkWidget*)statusbar, TRUE, TRUE, 0);
>
>   gtk_box_reorder_child(GTK_BOX(vbox) statusbar,9999);
>   gtk_box_pack_end( GTK_BOX(vbox), (GtkWidget*)box, TRUE, TRUE, 0 );
>
>   }
>   else
>   {
>      box = (GtkFixed*)gtk_fixed_new();
>   gtk_box_pack_end( GTK_BOX(vbox), (GtkWidget*)box, TRUE, TRUE, 0 );
> }

This probably achieves the desired goal, but it's not what
I meant.

  if (should_have_statusbar) {
      statusbar = create statusbar;
      gtk_box_pack_end(vbox, statusbar, ...);
  }
  gtk_box_pack_end(vbox, box, ...);

That's all.

In addition, box does not look like something logically
stacked from the bottom.  So unlike the statusbar which
should be packed with gtk_box_pack_end(), box should not
be packed with gtk_box_pack_end().

If you pack box with gtk_box_pack_start(), then the order in
which you add the widgets does not matter at all.  One is
packed from top, the other from bottom so they always end up
in the desired positions.  That's incidentally what your
original code does, except it does it *upside down*.

Why you attempt to pack the statusbar that belong to the
bottom with gtk_box_pack_start() and the box that is stacked
from the top with gtk_box_pack_end()?

Yeti

--
http://gwyddion.net/



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