I attached two widgets to a grid; a label and a spinbutton, then added the grid to Gtk::Window
I get blank output like this:
#include <gtkmm.h>
class SpinButtonExample : public Gtk::Window {
public:
SpinButtonExample();
};
SpinButtonExample::SpinButtonExample()
{
auto grid = Gtk::Grid();
auto label = Gtk::Label("Hi!");
auto adjustment = Gtk::Adjustment::create(0, 0, 10);
auto spinbutton = Gtk::SpinButton(adjustment);
grid.set_column_homogeneous(true);
grid.attach(label , 0, 0, 1, 1);
grid.attach(spinbutton, 1, 0, 1, 1);
add(grid);
show_all();
}
int main()
{
auto application = Gtk::Application::create("test.focus.spinbutton");
SpinButtonExample test;
return application->run(test);
}
However, if I use glade file it works fine but I want to do it with code and I'm stuck...