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 761363 - Unlabeled GtkCheckButton does not respect valign
Unlabeled GtkCheckButton does not respect valign
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkButton
3.19.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-01-31 16:16 UTC by LRN
Modified: 2016-02-07 14:14 UTC
See Also:
GNOME target: 3.20
GNOME version: ---


Attachments
Testcase. Run with or without an argument to get labeled or unlabeled checkbox (678 bytes, text/plain)
2016-01-31 16:16 UTC, LRN
Details
Screenshot: no label on checkbox (1.50 KB, image/png)
2016-02-01 19:15 UTC, LRN
Details
Screenshot: checkbox with a label (1.90 KB, image/png)
2016-02-01 19:15 UTC, LRN
Details
Testcase (794 bytes, text/plain)
2016-02-01 19:28 UTC, LRN
Details
Testcase v3 (1.12 KB, text/plain)
2016-02-01 21:24 UTC, LRN
Details

Description LRN 2016-01-31 16:16:53 UTC
Created attachment 320132 [details]
Testcase. Run with or without an argument to get labeled or unlabeled checkbox

When label is NULL, checkbox has incorrect vertical alignment.
Comment 1 Matthias Clasen 2016-02-01 17:55:23 UTC
I admit that I don't see any difference between labeled and unlabeled. Also, there is nothing next to your checkbutton to align it to, so setting valign will not make much of a difference.
Comment 2 LRN 2016-02-01 19:15:22 UTC
Created attachment 320212 [details]
Screenshot: no label on checkbox
Comment 3 LRN 2016-02-01 19:15:48 UTC
Created attachment 320213 [details]
Screenshot: checkbox with a label
Comment 4 LRN 2016-02-01 19:28:13 UTC
Created attachment 320214 [details]
Testcase

In my use-case i have a hbox with two widgets - a checkbox with no label and a label. Checkbox is packed to the left, label is packed to the right. Until roughly a month a go (maybe even less) label-less checkbox would valign just fine. But at some point that changed.

Actually, now that i'm looking, at this, i can't make the widget valigned at all. I *can* do that with Inspector, if i change the parameters of the label subwidget of the checkbutton widget, but i can't make the checkbox widget valigned as a whole.

So yeah, disregard my "no label" comments, they are not relevant.
Comment 5 Matthias Clasen 2016-02-01 19:44:51 UTC
so, you describe your use case... but your testcase still doesn't reproduce it.
Comment 6 LRN 2016-02-01 21:24:02 UTC
Created attachment 320234 [details]
Testcase v3

Fine, here's the testcase with a checkbox and a label packed in a box. Both are packed with fill && !expand, both are given 100 height request. Label is centered vertically, checkbox is not, even though both widgets *do* occupy the 100-tall area, according to inspector.
Comment 7 Matthias Clasen 2016-02-04 15:49:17 UTC
from my brief testing, this has something to do with the height request - as long as I don't set it, the checkbox is centered just fine with GTK_ALIGN_CENTER.
Comment 8 LRN 2016-02-04 16:10:02 UTC
Yes, without a height request the checkbutton remains small, if allowed to do so, and GTK_ALIGN_CENTER positions it at the center of the available vertical space.

With GTK_ALIGN_FILL it will be as big as allowed (you don't need to set height request on it, just put it in a box with some tall widget). If that happens, it will occupy all the space, but within that space it will be aligned to the top, regardless of what its vertical alignment value (which defaults to 0.5) is.

Using GTK_ALIGN_CENTER is a workaround, but not a fix. At the very least because GTK_ALIGN_FILL is, AFAIK, the default for any widget.