Re: Why does this behave the way it does?
- From: Kjell Ahlstedt <kjell ahlstedt bredband net>
- To: "D. R. Evans" <doc evans gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: Why does this behave the way it does?
- Date: Thu, 01 Mar 2012 11:01:36 +0100
Btw, have you considered using Gtk::Fixed instead of Table or Grid? I
has its own drawbacks, though. Its description lists several reasons not
to use it. I've never used it, and I don't know how useful it is.
Kjell
2012-02-29 19:36, Kjell Ahlstedt skrev:
2012-02-29 16:16, D. R. Evans skrev:
Oooh! That's interesting. Thank you for making things much clearer.
So suppose that the bug were fixed, and also suppose that I switch to
using
a Grid instead of a Table (since if that's deprecated, they might not be
willing to fix any bugs related to it). How would I get the Grid NOT to
ignore those cells where nothing has been attached?
When I tested with Grid, I added two empty labels like so:
// Force the grid to contain N_ROWS x N_COLS cells
Gtk::Label dummy1;
Gtk::Label dummy2;
grid.attach(dummy1, 0, 0, N_COLS, 1); // left, top, width, height
grid.attach(dummy2, 0, 1, 1, N_ROWS-1); // left, top, width, height
Now I've made some more tests. I also added
dummy1.set_size_request(SCREEN_WIDTH, SCREEN_HEIGHT/N_ROWS);
dummy2.set_size_request(SCREEN_WIDTH/N_COLS, SCREEN_HEIGHT -
SCREEN_HEIGHT/N_ROWS);
and all of a sudden the size is correct! This trick works also with
Table.
It's probably important to have at least one widget that spans only
one column, and one widget (not necessarily another one) that spans
only one row. The size request routines in GtkTable (and probably also
in GtkGrid) make a clear distinction between widgets that span a
single row and those that span multiple rows. The same goes for single
and multiple columns.
If you can accept one empty row and one empty column, where you attach
empty widgets (e.g. labels) it seems you can get the table or grid
size you want. I admit it's not very nice. With a Grid I think you
must anyway make sure a least one widget is attached to each column,
and one widget to each row. Ignoring empty rows and empty columns is
meant to be a great advantage of Grid, I believe. Often it is, but not
in your case.
Kjell
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]