After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 669989 - gtk_grid_attach(): Documentation doesn't mention multiple attachments to the same location
gtk_grid_attach(): Documentation doesn't mention multiple attachments to the ...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Documentation
3.3.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-02-13 14:15 UTC by Mark Vender
Modified: 2012-04-28 06:19 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mark Vender 2012-02-13 14:15:47 UTC
It's not clear what happens if one attaches a widget to a Gtk::Grid at a location, which is already occupied by another widget. It's possible to guess that the widget already in the grid will be replaced if it's location and size is the same as of the new widget. However, what if both widgets overlap only partially? E.g.

|---|---|
| A | A |
|---|---|---|
| A | AB| B |
|---|---|---|
    | B | B |
    |---|---|

    Mark
Comment 1 Murray Cumming 2012-02-15 09:04:43 UTC
This should be dealt with first in the GTK+ API documentation, I guess.
Comment 2 Mark Vender 2012-02-16 16:56:14 UTC
Also, the documentation doesn't say anything about how the size of the GtkGrid and spacing within it is managed. For example, let's say I insert two widgets, that span more than one cell, into the grid as follows:

 012345678
0
1 AA
2 AA   BBB
3 AA   BBB
4      BBB

What's the distance between the left side of B and the right side of A? Is it 1*column_spacing, or 4*column_spacing? What is the distance between the left side of A and the left side of the GtkGrid? Is it 0 or 1*column_spacing?
Comment 3 Matthias Clasen 2012-02-16 19:11:28 UTC
It seemed pretty obvious to me that you should not do that.
Furthermore, it not being mentioned in the docs should be a pretty strong hint that the outcome won't be what you hope for or can rely on.
Comment 4 Mark Vender 2012-02-16 19:26:01 UTC
Maybe we can add a note explicitly saying something like: "If one or more of the cells that _child_ would occupy is already occupied by another widget, the behaviour is undefined"?

What about the comment 2? Should I file a separate bug for a description of spacing. I felt that the subject is similar and there might be no need for another bug.
Comment 5 Murray Cumming 2012-03-02 08:36:14 UTC
> it not being mentioned in the docs should be a pretty strong hint
> that the outcome won't be what you hope for or can rely on.

I don't think that's how people think. People tend to guess what will happen and assume that that's the obvious thing, and that it's just that it's another thing that is not documented.

Whatever actually happens should be documented. I guess a second addition at the same position is just ignored, but I haven't tried this. I guess there are other container widgets that could use the same hint.