View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0027491 | Lazarus | LCL | public | 2015-02-18 14:50 | 2017-08-15 11:23 |
Reporter | Howard Page-Clark | Assigned To | Michl | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 1.1 (SVN) | ||||
Target Version | 1.8 | ||||
Summary | 0027491: TGroupBox.Caption not greyed when disabled on Windows | ||||
Description | A disabled groupbox correctly disables its contained controls, but its Caption is not correspondingly greyed. | ||||
Steps To Reproduce | On Windows, set the Enabled property of any groupbox to False. | ||||
Additional Information | Blaazen on the forum has tested QT and Linux where the TGroupBox.Caption is greyed when Enabled=False. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | r53906 | ||||
LazTarget | 1.8 | ||||
Widgetset | |||||
Attached Files |
|
|
It is greyed in Delphi ? |
|
On Delphi 7 it does gray out the caption (with XP manifest). |
|
The problem seems to be a bug in recent versions of Windows comctrl.dll. If you use a manifest (see attached maingroupbox.manifest) that removes dependency on (themed) comctrl the exe will show a GroupBox whose Caption greys out along with all its contained controls as expected. Seems you can have themes or properly functioning Groupbox captions, but not both. If this is the case, a possible crude workaround would be to plant a TLabel over the groupbox Caption and draw it disabled... but this is just a poor hack. |
|
|
|
I cannot see how to do OK with grayed in WinAPI var b: boolean; procedure TForm1.Button1Click(Sender: TObject); begin b:= not b; EnableWindow(GroupBox1.Handle, bool(b)); GroupBox1.Invalidate; end; also dont give grayed Grpbox. So close as "cannot fix".. |
|
> The problem seems to be a bug in recent versions of Windows comctrl.dll. Any reference / link to that? |
|
http://stackoverflow.com/questions/26481189/how-to-make-the-group-box-text-to-be-disabled-when-group-box-is-disabled "Further to what Michael Walz said below, you could handle WM_CTLCOLOR in the parent and return the grey colour if the group box is disabled." |
|
OK, resolving as not fixable then. |
|
I've tested the issue for a while. As pointed out, this doesn't work, if themes enabled: https://msdn.microsoft.com/de-de/library/windows/desktop/bb787524(v=vs.85).aspx But better then nothing, we can paint the caption ourself. So I made this workaround in revision 53906. Tested with/without themes, DPI aware on Win XP, 7 and 10. Please test an report here, if I miss something. Thank you |
|
|
|
I tested GroupBox, RadioGroup and CheckGroup on Windows 7 64bit. All works OK :) Thank you Michl. |
|
Should we really fix bugs in MS Windows? |
|
Although bug in MS Windows, but for the users it does not matter. They expect efficient program. Liability for defects always falls on the author of program. |
|
@Bart: I also thought on that question a longer while, before I commited the code. Normally, I would call it a feature. But here the behaviour breaks the rule of other widgetsets (what is ok) but also breaks the own rule of design (what is not ok) (all other components, I tested, are grayed out). The best thing would be a fix from MS side. But this bug is here since more then 7 years (http://stackoverflow.com/questions/1737108/how-do-i-set-the-font-and-color-for-a-group-box-caption-using-win32), so I don't see it. There are a lot of workarounds in the widgetsets code to make things to work (what could be called a bug or inconsistency from widgetset). To give Lazarus components consistency, I would work around bugs, as much as we can. If there are problems with this workaround, please let me know. Now it's easy to reject the code. [Edit]: wrong link, this is the correct one: https://groups.google.com/forum/#!topic/microsoft.public.vc.mfc/BNHCYsmydKc |
|
I like the fix. What's wrong with fixing a Windows bug? There is some inconsistency in painting of the caption, though. Add a label to the groupbox and disable the groupbox - the disabled caption will not look the same as the disabled label. |
|
I've seen this too. Please have a look at the added example GroupBoxTest.zip. There you can see, the label has a wrong color, if it is disabled (maybe a new bugreport or we let it so?). |
|
Yes, and the disabled TLabel looks differently from a disabled TStaticText. Lots of inconsistencies... TLabel is painted complety with LCL commands. Isn't there a ThemeService/ThemeElementDetails for painting text which could be used for TLabel, TStaticText, TGroupbox caption? |
|
This was my first attempt too, but no, there isn't. Have a look at themes.pas. |
|
@wp: Yes, the label needs a redesign. It is wrong disabled on Win32, also on GTK2 and afaik all other widgetsets. The current disabled state is done for unthemed Win32 widgetset and used for all widgetsets. I think, I will insert a TWSCustomLabel, so we can derive widgetset labels to fix some issues (we have some more for TLabel and Win32). |
|
First, I fixed the default disabled drawing for TStaticText, TLabel, TPanel and ThemeServices. Tested on Windows XP, 7, 10, Linux Mint GKT2 and Linux Mint Qt4. Revision 53912 - 53916. Hope it works for the other widgetsets too. Please test an report, if I miss something. |
|
Looks good (Win 10), thank you |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-02-18 14:50 | Howard Page-Clark | New Issue | |
2015-02-18 15:21 | Zeljan Rikalo | Note Added: 0081214 | |
2015-02-18 16:57 | Bart Broersma | Note Added: 0081216 | |
2015-04-14 22:08 | Howard Page-Clark | Note Added: 0082903 | |
2015-04-15 04:00 | Derit Agustin | File Added: Screenshot_4.png | |
2017-01-03 18:05 | CudaText man | Note Added: 0097273 | |
2017-01-07 14:02 | Bart Broersma | Note Added: 0097349 | |
2017-01-07 19:50 | Janusz Tomczak | Note Added: 0097360 | |
2017-01-07 19:53 | Janusz Tomczak | Note Edited: 0097360 | View Revisions |
2017-01-07 22:53 | Bart Broersma | LazTarget | => - |
2017-01-07 22:53 | Bart Broersma | Note Added: 0097363 | |
2017-01-07 22:53 | Bart Broersma | Status | new => resolved |
2017-01-07 22:53 | Bart Broersma | Resolution | open => not fixable |
2017-01-07 22:53 | Bart Broersma | Assigned To | => Bart Broersma |
2017-01-09 18:03 | Michl | LazTarget | - => 1.8 |
2017-01-09 18:03 | Michl | Note Added: 0097375 | |
2017-01-09 18:03 | Michl | Assigned To | Bart Broersma => Michl |
2017-01-09 18:03 | Michl | Status | resolved => feedback |
2017-01-09 18:03 | Michl | Target Version | => 1.8 |
2017-01-09 18:04 | Michl | File Added: GroupBoxTest.zip | |
2017-01-09 18:05 | Michl | Resolution | not fixable => reopened |
2017-01-09 19:00 | Janusz Tomczak | Note Added: 0097377 | |
2017-01-10 00:25 | Bart Broersma | Note Added: 0097386 | |
2017-01-10 09:18 | Janusz Tomczak | Note Added: 0097389 | |
2017-01-10 09:56 | Michl | Note Added: 0097390 | |
2017-01-10 09:57 | Michl | Note Edited: 0097390 | View Revisions |
2017-01-10 10:03 | Michl | Note Edited: 0097390 | View Revisions |
2017-01-10 11:26 | wp | Note Added: 0097392 | |
2017-01-10 11:43 | Michl | Note Added: 0097394 | |
2017-01-10 11:46 | Michl | Note Edited: 0097394 | View Revisions |
2017-01-10 11:56 | wp | Note Added: 0097395 | |
2017-01-10 12:08 | Michl | Note Added: 0097396 | |
2017-01-10 13:54 | Michl | Note Added: 0097397 | |
2017-01-10 17:22 | Michl | Note Added: 0097399 | |
2017-01-10 17:47 | Michl | Note Edited: 0097399 | View Revisions |
2017-01-10 19:53 | wp | Note Added: 0097402 | |
2017-02-03 17:46 | Michl | Status | feedback => resolved |
2017-02-03 17:46 | Michl | Resolution | reopened => fixed |
2017-04-17 12:05 | Michl | Relationship added | related to 0031670 |
2017-04-17 14:10 | Michl | Fixed in Revision | => r53906 |