Gtk::Grid can't see anything



HI,

I'm trying to draw a day calendar in Gtkmm, and for some reason, I can't
see anything with the code below. Just the window.

Can anyone help?

int
main (int argc, char *argv[])
{
        Gtk::Main kit(argc, argv);


        //Load the Glade file and instiate its widgets:
        Glib::RefPtr<Gtk::Builder> builder;
        try
        {
                builder = Gtk::Builder::create_from_file(UI_FILE);
        }
        catch (const Glib::FileError & ex)
        {
                std::cerr << ex.what() << std::endl;
                return 1;
        }
        Gtk::Window* main_win = 0;
        builder->get_widget("main_window", main_win);

        Gtk::Grid m_grid;

        const int i_START_HOUR = 6;
        for(int i = i_START_HOUR; i < 7; ++ i)
        {
                std::stringstream ss;
                ss << i;
                Gtk::Button label1(ss.str() + ":00"), label2("06:15"),
label3("06:30"), label4("06:45");
                
                m_grid.attach(label1, 0, i - i_START_HOUR,     1, 1);
                m_grid.attach(label2, 0, i - i_START_HOUR + 1, 1, 1);
                m_grid.attach(label3, 0, i - i_START_HOUR + 2, 1, 1);
                m_grid.attach(label4, 0, i - i_START_HOUR + 3, 1, 1);
        }
        
        main_win->add(m_grid);
        main_win->show_all_children();
        
        if (main_win)
        {
                kit.run(*main_win);
        }
        return 0;
}



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