Manipulate Radio Buttons, Check Boxes Text Color?

Desktop applications.

Is there a way (workaround) to manipulate controls text color without supporting Dark Mode?
I want to make a window background dark gray but I can’t manipulate the captioning of controls such as Radio Buttons and Check Boxes, so as a result, the text shown in those controls is impossible to read.

Of course I can create my own controls on a canvas or support Dark Mode (only on macOS) but that’s not what I’m looking for here, I’m talking about a basic missing Xojo functionality of some controls that limit my design capability.

You should be able to alter the text colour via a declare into the cocoa framework.

I’m sure I’ve also done this using the MBS plugins.

Thank you @kevin_g, what MBS plugins, and does it work cross-platform (Windows/macOS)?

Why not simply a RadioButton / CheckBox without text and a TextField with it? You could put it on a ContainerControl and implement the events and properties there.

Exactly what I started an hour ago :laughing:
But still, isn’t it embarrassing that in Xojo 2021 I need to do such awkward hoops and loops just to achieve something that should have been so simple?

No, not at all. What you’re trying to do is the opposite of user friendly. Xojo prides itself on using native controls that respond to the system configuration. Custom controls and colors are not actually what Xojo aims to do.

1 Like

I see what you mean, but if that’s really the case, I would expect it to figure out Windows dark mode by now while many others do it successfully for over a year now.

I’m not in front of my computer but I imagine you could manipulate the NSAttributedString belonging to the NSControlMBS property of the Checkbox.

Not sure about Windows. It might be possible to intercept a message and manipulate the text colour. The MBS plugins might have a way for you to capture the messages or alternatively the WFS classes can do this.

1 Like

Thank you @kevin_g, I’ll look into it;)

This may not be a great user experience, though, as the single control has several thought behaviours.
Among other things, remember the user should be able to select the checkbox/radio button when clicking on the label. This means you must handle the click on the label (and show the button as being pressed while this is done; can be tricky), track the mouse (MouseDrag) and validate (or not) in MouseUp, if the mouse is still inside the label. Also, if the user drags out of the label (but over the box), you’d still be considering the mouse is over the control.
And that’s just one thing among others.

Circumventing the original behaviour of an OS control most of the times leads to unwanted or unexpected facts to the user (especially advanced ones).

Absolutely right @Arnaud_N , and I did all those things (and more) to make the UX as ‘intelligent’ as possible.
It works very nice but, as expected, takes tons of effort programming it and that is why I really don’t think it’s the way to go and it is only a lame workaround at best.
Xojo should have given us much smarter tools to achieve such design needs while still keeping the native OS controls should the programmer chooses to.
It’s inconceivable that we can’t design dark UI that has a good user experience without going through some awkward hoops and loops or buy some third-party plugin or design all the controls from scratch by yourself.
I would expect a simple boolean property such as aRectControl.OnDrakUI = True/False, which inverts the control text color from dark to light by demand, and overrides the inherited IsDarkMode for a specific control should the programmer chooses to for advanced/flexible UI design on all desktop platforms.

I have hundreds of users on both Mac and PC (some even work with it on both Mac and PC at the same time) and they all expect to see exactly the same UI/UX regardless of what OS they install my software on.

1 Like