|
Post by johnnyd on Jul 8, 2020 11:21:15 GMT -5
Hi,
Not been here for a very long time!
Now, not sure if this is a bug, but if I issue "!disable" to a groupbox, it doesn't grey out. Using Windows 10.
Issuing a "!hide" works and will hide it.
Not using stylebits, just plain, unfettered groupbox.
Thanks,
John.
|
|
|
Post by Rod on Jul 8, 2020 11:38:41 GMT -5
The group box or the controls within The group box? Code always helps get the right answer.
|
|
|
Post by johnnyd on Jul 8, 2020 13:26:30 GMT -5
Hi Rod,
It's the groupbox itself. The controls within it behave, just the box itself.
The example code for what it is:
groupbox #main.a,"Test",5,5,50,50 open "Test" for window as #main #main.a,"!disable"
Step through it in the debugger. Not added NG a wait or quit, no point for this.
John.
|
|
|
Post by Rod on Jul 8, 2020 14:35:42 GMT -5
I am still confused and will need to get to my pc. You disable the group box, the controls all disable? Or not? Or is it the fact that you can’t just see the group box changing state? A full description of what you expect and what you get would help.
|
|
|
Post by johnnyd on Jul 8, 2020 14:50:06 GMT -5
Hi Rod,
I have the groupbox with controls within it. I want to disable the box and controls within it.
All the controls will disable (grey out) when I give the relevant disable commands to them, but the groupbox doesn't grey out when I give it its command.
The demo I gave illustrates it and is all it needs to demonstrate it.
John.
|
|
|
Post by alincon on Jul 8, 2020 18:16:12 GMT -5
Why isn't disabling all the controls within the group box enough? Seems to me it is.
r.m.
|
|
|
Post by johnnyd on Jul 9, 2020 2:57:17 GMT -5
Hi,
It looks better, and the fact it says so in help!
It's no biggie, but I'd prefer it did what it's supposed to do.
Might have to live with it.
John.
|
|
|
Post by Rod on Jul 9, 2020 7:46:44 GMT -5
I think it was a Windows change that stopped showing the groupbox status. Another idea since you can change the groupbox text
nomainwin groupbox #main.a,"Test",5,5,60,60 checkbox #main.b,"Ok",[set],[reset],20,30,40,20 button #main.c,"Toggle",[toggle],UL 10,80,40,20 open "Test" for window as #main t=1 wait
[set] wait
[reset] wait
[toggle] if t then #main.a "" #main.a "!disable" #main.b "disable" t=0 else #main.a "Test" #main.a "!enable" #main.b "enable" t=1
end if wait
|
|
|
Post by johnnyd on Jul 9, 2020 11:12:56 GMT -5
Hi Rod,
A workaround is to have a groupbox with no text, then overlay statictext at the groupbox label position, then enable & disable that and is quite effective.
Might have guessed Windows would stick its oar in!
John.
|
|
|
Post by Chris Iverson on Jul 9, 2020 16:17:24 GMT -5
This is indeed a windows issue, but it's apparently an old one. stackoverflow.com/questions/26481189/how-to-make-the-group-box-text-to-be-disabled-when-group-box-is-disabledThat thread says they see the same issue going as far back as Windows XP. Out of curiosity, when determining this, I created a quick test C# application to test if I could see the groupbox being disabled, and it surprised me when I saw that it DOES get disabled. Then, I tried it using C/C++, and noticed that it only greys out if visual styles are turned off. For some reason, when turned on, the groupbox won't paint as greyed out by default if disabled. Then I was curious why C# was different, so I looked up the source code to the groupbox control in .NET. I found that, rather than let the system handle drawing it(like many of the Windows Forms controls do), the GroupBox control in C#/.NET Windows Forms explicitly overrides the text color to "grey out" when it's disabled.I note that a comment above that code even mentions working around a "default theme color" issue.
|
|
|
Post by johnnyd on Jul 9, 2020 18:26:34 GMT -5
Hi Chris and many thanks for having a good dig!
It's not something I've ever used until now, but now I know.
The statictext works a treat and looks very effective.
John.
|
|