Is there a way to change the color of the label of a radio button?
I’m building an interface on a dark background and want all my labels to be white. Do I have to make a whole set of separate labels, leave my radio button labels blank and put text labels in there to fake it? Or am I missing something here?
This is typically done using a ContainerControl with a RadioButton whose width is very small (around 20, I think), and a Label to the right. You wire the label up to change the value of the RadioButton on click, and you should be good to go. Just expose the properties you need for the RadioButton on the ContainerControl.
ok… seems like it should work like Text Labels do, if you ask me – since most of a radio button is its text.
I feel like Window should have basic text settings that get inherited by all child objects by default. That would certainly make using non-standard fonts/sizes/colors a heck of a lot easier than it is now (having to change each one separately, or in the case of radio buttons, jump through hoops to make it work).
I would open a Feedback Case if this is something you’re interested in seeing added to the language but, if I remember correctly, this was a limitation in how Win32 RadioButtons function (or did a long time ago).
And you can use the code included in the App Kit to tell the OS to even make a single control or group of controls use Dark Aqua.
Finally, there is OS API for setting the label color of system controls, Xojo doesn’t expose it (and may overwrite it) but it is there, see the code for the OWDestructiveButton on how to do it.
The Ohanaware App Kit is included as part of this years Omegabundle, so you can score the source code to make beautiful Mac apps that your customers will love, App Wrapper, ExeWrapper, Anthony’s Graffiti Suite and many others to help you build outstanding applications with Xojo https://www.omegabundle.net/
p.s. I’ve been working really hard on Release 3 of the App Kit and I’m almost ready to show you all the new exciting things that you’ll be able to add to your Mac apps.
Thanks. That’s pretty cool, but I’m really hoping for something that’s less workaround-y. It seems sort of crazy to me that the text attributes can’t be changed.
It does. I’m not a fan of dark mode. In most cases it looks terrible in my opinion, both Mac and Windows. I’m not just looking to invert the usual background/text relationshop. The background is to be a specific neutral grey, which is the standard for film and video applications. DaVinci Resolve is a good example, which looks this way regardless of the OS dark/light preference:
My problem with dark mode is that it always feels so inconsistent and I don’t like using the rest of the operating system in that mode. It’s hard to explain, I just think it’s a really annoying trend and find both operating systems hard to use in that mode. But it doesn’t bother me for specific applications.
Yes it is old that we in xojo can’t change colors of radiobuttons or checkboxes or anything else.
The way that is even less code, all you do is copy and past and change color values is this one:
take a radiobutton and resize it to 20 x 20 set it to transparent.
Then add a text label set this one also to transparent.
Add the mousedown event and any onther you like, for hover and leaving.
in the mousedown event paste this bit of code : #pragma unused X #pragma unused Y
Then the radiobuttno action event:
Past this bit of code:
label2 will be your seconde radiobutton.
If you need only one radiobutton i would use a checkbox.
This is hoe i do it with a checkbox and a label:
Checkbox action event:
if me.Value=True then
and the label with the checkbox: #pragma unused X #pragma unused Y
if CheckBox1.Value=False then
I argree with you, it should be easier to do things like this.