Something simple I can't do



Hi,
I'm haven't been able to make the widgets contained in a Gtk::Grid adjust their size and spacing when the Grid's size change. I read it is a matter of widgets' expand and margin property and yet I can't make it work. When the Grid is resized a blank space appears where I want widgets to be.
I have this code:
Gtk::Main kit(argc, argv);

Gtk::Window* main_win = new Gtk::Window (Gtk::WINDOW_TOPLEVEL);
main_win->set_title ("example");

Gtk::Grid grdMain;
Gtk::Button* cmdOne = new Gtk::Button("1", true);
Gtk::Button* cmdTwo = new Gtk::Button("2", true);
Gtk::Button* cmdThree = new Gtk::Button("3", true);

grdMain.attach (*cmdOne, 1, 1, 1, 1);
grdMain.attach_next_to (*cmdTwo, *cmdOne, Gtk::POS_BOTTOM, 1, 1);
grdMain.attach_next_to (*cmdThree, *cmdOne, Gtk::POS_RIGHT, 1, 2);

main_win->add(grdMain);
main_win->show_all_children ();

kit.run(*main_win);

I've tried changing property_margin and property_expand for all the button inside the Grid but doing it hasn't solved anything.

What I want is the Buttons to fill all the space inside the window. Thank you for your help.
Btw, sorry for my english, I speak spanish very well :P


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