Re: Why does this behave the way it does?



I looked in the source code of GtkTable, and I think the error is in gtk_table_size_request_pass3().
If you're insterested, you can look at
http://git.gnome.org/browse/gtk+/tree/gtk/deprecated/gtktable.c

The size calculation is not perfect when widgets span multiple columns, and they partly overlap as in your example. (One widget spans columns 30..34 and another one spans columns 20..31.) If you let the second textview span columns 20..34 the width is correct.

Since Gtk::Table is deprecated and you should use Gtk::Grid in new code, I also tested with Gtk::Grid. The result is the same, with the added complication that Gtk::Grid ignores rows and columns where no widget has been attached. Such rows and columns is allocated no space, not even if the grid is homogeneous, i.e. all cells have the same size.

If you file a bug report, assign it to gtk+.

Kjell

2012-02-29 01:24, D. R. Evans skrev:
You lost me.

I've told gtkmm how big I want the window to be (haven't I?):
    window.set_size_request(SCREEN_WIDTH, SCREEN_HEIGHT);

I've told gtkmm how big I want the table to be (haven't I?):
    Gtk::Table  table(N_ROWS, N_COLS, true);

If I then put five characters into a five-character cell, it displays
exactly as I would expect. If I also put five characters into a
twelve-character cell, exactly what stipulation is violated?

I think you are saying that somehow putting some text into the
twelve-character cell makes the total table size larger that the fixed
window size. But how can this be true? I've put only five characters into a
widget that occupies 12 cells. There is plenty of room for those characters
without increasing the width of the table (you can see that there's plenty
of space left to the right of the characters).

Hence my mystification :-(

I could understand it if I was trying to stuff too many characters into the
second widget. That would cause the second widget to expand to accommodate
the text. And that in turn (because the cells are homogeneous) would cause
the first widget also to expand laterally. Everything would grow
proportionally in the horizontal direction. That all makes perfect sense.
But since I'm not over-filling the second widget, what causes the lateral
expansion?

Incidentally, I don't see any evidence that homogeneity has been lost
anywhere in this process. The width of the cells changes, but it looks to
me that the widths of *all* cells changes, so homogeneity seems to be
maintained.

   Doc




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