Strange widget packing problem/issue



Hi,

I've come across some strange behaviour when packing widgets
that I can't quite figure out. What's even more weird, I have
several other dialogs which use the same code (almost verbatim)
and they don't have this problem/behaviour. The code goes (more
or less) like this (I'm inserting into a window of 450 x 400,
which is enough to proplerly hold/display all the widgets I add):

     Gtk_Table t = new Gtk_Table (6, 8);

     // I typically pack widgets like this: label + widget in 1 hbox
     // for a total of 9 hboxes + 2 separators
     d_hbGenSeed.pack_start (d_lblGenSeed, TRUE, TRUE, GuiDialogOAC::s_HBOff)
     d_lblGenSeed.show ();
     d_hbGenSeed.pack_end (d_btnGenSeed, TRUE, TRUE, GuiDialogOAC::s_HBOff);
     d_btnGenSeed.set_active (TRUE);
     d_btnGenSeed.show ();
     d_vbList.pack_start (d_hbGenSeed, TRUE, TRUE, GuiDialogOAC::s_VBOff);
     d_hbGenSeed.show ();

     d_lblSeed.set_justify (GTK_JUSTIFY_RIGHT);
     d_hbSeed.pack_start (d_lblSeed, TRUE, TRUE, GuiDialogOAC::s_HBOff);
     d_lblSeed.set_sensitive (FALSE);
     d_lblSeed.show ();
     sprintf (d_seedInitStr, "%d", 10);
     d_enSeed.set_text (d_seedInitStr);  // entry box
     d_enSeed.set_sensitive (FALSE);
     d_hbSeed.pack_start (d_enSeed, TRUE, TRUE, GuiDialogOAC::s_HBOff);
     d_enSeed.show ();
     d_vbList.pack_start (d_hbSeed, TRUE, TRUE, GuiDialogOAC::s_VBOff);
        d_hbSeed.show ();

     // finally, at the end
     d_optionsFrame.add (d_vbList);
        this->d_table->attach (d_optionsFrame, 3, 6, 1, 7);


The weird thing is this: when I don't pack the entry box d_enSeed,
all the widgets (which typically are a Label and a HScale) are niceley
aligned (and d_hbSeed displays a centered label). When I'm also
packing d_enSeed (the entry box), the area allocated to HBoxes
holding my widgets, all of a sudden is expanded beyond the (right) edge
of the window.

As said, I have other (equally sized) dialogs which use the same code
and don't disappear off the edget of the screen. Thinking that I may
have too many objects in my table, I've tried to allocatate the table
as (6, 10) and attach it as (3, 6, 1, 9), but that made no difference. Furthermore
I doubt that this has something to do with Gtk--; everything else I do (in
terms of widget packing) works as it should ...

I realize that this is a bit vague, but I've stared at this particular
piece of code for a few hours now and can't figure out what's wrong
with it. Chances are I'm doing something stupid that I'm just overlooking,
so I'm hoping that with all the eyes (and brains) on this list, someone
can point me to something trivial I'm overlooking (or just don't get).


Thanks for any insights
--> Robert



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