Alignment of buttons with gtkmm - Linux

This is a discussion on Alignment of buttons with gtkmm - Linux ; Hello, when I use gtkmm and set buttons with a layout manager (e.g. HButtonBox, HBox), the buttons are always aligned to the middle of the "box". I didn't find any solution to align the third button to the right. Does ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Alignment of buttons with gtkmm

  1. Alignment of buttons with gtkmm

    Hello,

    when I use gtkmm and set buttons with a layout manager (e.g. HButtonBox,
    HBox), the buttons are always aligned to the middle of the "box".
    I didn't find any solution to align the third button to the right. Does
    anybody know how to do that? I already tried "pack_end" instead of
    "pack_start" or I also tried to use the different ctors for hbox, but I
    didn't succeed.
    My target is a small bar with two buttons to the left, followed by a big
    space, which is followed by the close button who should be aligned to
    the right.

    Here is my example:

    #ifndef GUIMENU__H
    #define GUIMENU__H

    #include
    #include
    #include

    class GUIMenu : public Gtk::Window {

    public:
    GUIMenu();
    virtual ~GUIMenu();

    protected:
    virtual void onClick();

    Gtk::HBox hTopBox, hbox1, hbox2;
    Gtk::Button buttonInput, buttonClose, buttonBerechnungen;
    };

    #endif
    ------------------------------------------

    #include "GUIMenu.h"

    GUIMenu::GUIMenu() :
    hbox1(false, 10),
    hbox2(false, 10),
    buttonInput("Matrix eingeben"),
    buttonClose("Schliessen"),
    buttonBerechnungen("Berechnungen ausgeben") {

    set_title("Calculator");
    set_border_width(0);
    set_resizable(false);
    hbox1.set_border_width(10);
    hbox2.set_border_width(10);
    hbox1.pack_start(buttonInput);
    hbox1.pack_start(buttonBerechnungen);
    hbox2.pack_start(buttonClose, Gtk::PACK_EXPAND_PADDING, 50);
    hTopBox.pack_start(hbox1);
    hTopBox.pack_start(hbox2);
    add(hTopBox);
    buttonClose.signal_clicked().connect(sigc::mem_fun (*this,
    &GUIMenu:nClick) );

    show_all_children();
    }

    GUIMenu::~GUIMenu() {}

    void GUIMenu:nClick() {
    hide();
    }

    Thanks,
    Markus

  2. Re: Alignment of buttons with gtkmm

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.6 (GNU/Linux)

    iD8DBQFGh9xWVcFcaSW/uEgRArYyAKC6oTvscJVQQ3+aj186qiB2tHJycQCff+/E
    a8XJcRNaMydCnlp9sSu1c4g=
    =FkEo
    -----END PGP SIGNATURE-----

  3. Re: Alignment of buttons with gtkmm

    Hello,

    thanks for your test file. I'm still not exactly sure how you managed it
    but I'll get granular on it tomorrow.

    Markus

+ Reply to Thread