Having a Gtk::Grid
and attempting to do the following:
Gtk::Image *im;
for(int i=0; i<10; ++i)
{
for(int j=0; j<10; ++j)
{
im = Gtk::manage(new Gtk::Image());
im->set("test.jpeg");
grid->attach(*im, i, j, 40, 40);
}
}
The problem is that it generates something very strange:
The goal is to have the same image added separately.
The default description of Gtk::Grid::attach()
is confusing. The last two attributes are labeled as "width" and "height" and it can be expected to mean the pixel dimentions of an added Widget. However, this is not what these parameters mean at all.
In reality they mean something closer to the "span". Substituting these values to 1 yields correct results.
Gtk::Image *im;
for(int i=0; i<10; ++i)
{
for(int j=0; j<10; ++j)
{
im = Gtk::manage(new Gtk::Image());
im->set("test.jpeg");
grid->attach(*im, i, j, 1, 1);
}
}