Maintaining BACKCOLOR for a CHECKBOX in 10.0.7 (OpenInsight 64-bit)
At 22 JAN 2020 01:01:56PM Brad Bishop wrote:
I have a series of CHECKBOX controls that are on a form with a light grey background (btnFace). For consistency, I need these checkboxes to have the same background color (btnFace). I have set the controls themselves to have a the same background color and each control appears correctly when the form is created. However, whenever one of the CHECKBOX controls is enabled the background color of the enabled control changes to white (which is the controls original default background color). I have not had any luck finding where I can set the enabled background color for an individual control. Is this even possible or am I just in the dark on where to look ?
Thanks in advance for the help.
At 22 JAN 2020 01:43PM Carl Pates wrote:
Hi Brad,
Are you talking about the color of check box itself, or the color of the control that surrounds it and contains the text?
The check box element is controlled by the current theme and is set to the usual disabled "btnFace" color or "Window" color if enabled. There is no API to change this at present.
The color surrounding the box and text should respond to the normal BACKCOLOR property - it should not be affected by the ENABLED property.
Thanks
At 22 JAN 2020 01:52PM Brad Bishop wrote:
This is the normal backcolor property. To confirm I set the backcolor lime green. I then verified when I ran the form that lime green was displayed. Then I enable the form create event and enabled the control via set_property in the event and viola the color on the control is changed to the default (white). I also tested with the disable property and the control always remains the same color so I think this is an enable only issue.
At 22 JAN 2020 05:03PM Revelation Software wrote:
Post removed by Revelation Software
At 24 JAN 2020 06:32AM Carl Pates wrote:
Hi Brad,
I can't reproduce this - I've created a blank form with a disabled checkbox - the BackColor of the form is LimeGreen, as is the BackColor of the checkbox.
In the Create event of the form the Enabled property of the checkbox is set to 1.
Run the form and the BackColor of the checkbox is still LimeGreen after it has been Enabled.
Can you check if this is the same on your system (with a simple form like above) so we can verify if the problem is something specific to the existing form?
Thanks
At 24 JAN 2020 12:54PM Brad Bishop wrote:
Following your advice, I created a new form and procedure and what do you know it worked !!
So back to the original form and proc I went( ps, I was not the original author). I discovered that on line 1682 (out of 2100) the backcolor on all editable controls was being forced to white. I didn't even know that the backcolor could be changed dynamically. So I added logic in the read section to save the backcolor in the controls misc property. Then it was a simple matter of checking the misc property to set the backcolor back to the original value rather than white.
I'm a little red faced at not testing the issue on a new\blank form and also at not finding this myself earlier. But I am now a wiser developer.
thanks !!
At 24 JAN 2020 01:01PM Carl Pates wrote:
Hi Brad,
No worries - glad the problem is sorted :)
Regards