Re: Help wth packing

Hi Kjell,
adding an Alignment places the label just below the ToolPalette but this is what happen:
When available space is minimum, the VBox gives a vertical space to the ToolPalette equal than the space needed to show all the ToolItemGroups.
Immediately after the ToolPalette here comes the other widget.
But if I give more space (enlarging the window) VBox divides it between the ToolPalette and the other widget enlarging the space in favor of the other widget and not giving to the ToolPalette all the needed space (when it is fully expanded)
You can test it with the source code here:
and modifying the lines with this code:

  Gtk::Alignment *my_alignment=Gtk::manage(new Gtk::Alignment(0.0, 0.0, 0.0, 0.0));
  Gtk::Label *my_label=Gtk::manage(new  Gtk::Label("Label"));
  m_VBox.pack_start(m_ToolPalette, Gtk::PACK_EXPAND_WIDGET);
  m_VBox.pack_start(*my_alignment, Gtk::PACK_EXPAND_WIDGET);

This is visually what I get:
1) When ToolPallete is collapsed I have this:"">2) If I expand one of the ToolItemGroups I have this:"">3) If I enlarge the window I get this:"">4) When I really want this:"">

De: Kjell Ahlstedt <kjell ahlstedt bredband net>
Para: Carlos Lopez Gonzalez <carloslopezgonzalez yahoo es>
CC: "gtkmm-list gnome org" <gtkmm-list gnome org>
Enviado: lunes 26 de septiembre de 2011 19:32
Asunto: Re: Help wth packing

Hi Carlos,

Have you tried using Gtk::Alignment? Perhaps something like this:

// Constructor: xalign=0.5, yalign=0.0, xscale=0.0, yscale=0.0
my_alignment(0.5, 0.0, 0.0, 0.0);
my_vbox.pack_start(my_label, Gtk::PACK_SHRINK);
my_vbox.pack_start(my_toolpalette, Gtk::PACK_EXPAND_WIDGET);
my_vbox.pack_start(my_alignment, Gtk::PACK_EXPAND_WIDGET);

I don't know if the result will be exactly what you want. (I don't use
Gimp, and your reference to it is not very informative to me.) But
Gtk::Alignment gives you many possibilities.


sön 2011-09-25 klockan 20:53 +0100 skrev Carlos Lopez Gonzalez:
> Hi,
> I want to pack three widgets vertically in this order:
> 1) Gtk::Label
> 2) Gtk::ToolPalette (width ToolItemGroups inside)
> 3) Gtk::CheckBox
> For that I've prepared a VBox and I've packed the three widgets like
> this:
> my_vbox.pack_start(my_label, Gtk::PACK_SHRINK);
> my_vbox.pack_start(my_toolpalette, Gtk::PACK_EXPAND_WIDGET);
> my_vbox.pack_start(my_chekbox, Gtk::PACK_SHRINK);
> Doing this, the check box is always at the bottom of the vBox
> regardless if the size of the
> tool palette expanded or not force it.
> I can expand the tool palette and it will fill all the remaining space
> left by the label and the check box.
> If I do this:
> my_vbox.pack_start(my_label, Gtk::PACK_SHRINK);
> my_vbox.pack_start(my_toolpalette, Gtk::PACK_SHRINK);
> my_vbox.pack_start(my_chekbox, Gtk::PACK_SHRINK);
> the check box is always after the tool palette but the tool palette
> available space is limited to the height
> given by the number of ToolItemGroups inserted.
> How do I pack the three widgets to make the check box always placed
> exactly after the tool palette and
> at the same time be able to expand the tool palette more than its
> ToolItemGroups size?
> I would like to have the same behavior than the tool options for the
> Gimp 2.6 series. The 'Brush Dynamics'
> option expands the way I want.
> Thanks!
> Carlos

> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org

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