242 views
in Getting started by
How can I set the color of the text "switch" on the Default Widgets page of the WidgetsDemo example ?

According to documentation I do this through the Appearance setting of the object.
For ToggleButton this is WidgetSet::Switch_Medium.

When I go to unit WidgetSet I find class WidgetSet::WidgetConfig ToggleButtonConfig.

But when I go into ToggleButtonConfig I find properties for LabelOffColorDefault and so on, but no property for the Label color.

The documentation shows  how to do this for a pushbutton, but the toggleswitch does not seem to have a label color setting.

I mention the Widgets Demo as an example.

In my own application I have many toggle switches and I would like the labels to be black, not the gray colour they are now.

I realize as a last resort I could set the Label on the toggleButton to "", and add a Text object  beside it, and set the color of the text object, but that seems like an extra step.

1 Answer

+1 vote
by
 
Best answer

Hello Robert,

the properties LabelOffColorDefault, etc. are exact what you are looking for. However, specifying a new color is not so easy. The Toggle Button has several states. To distinguish the states you can and have to configure the colors for each state individually. The property LabelOffColorDefault controls the color of the label when the toggle button is in the Off state and the user does not touch on it (Default). The other properties determine the colors for other states. If you want the Toggle button always with black label, just initialize all Label-Color properties with the black color #000000FF. See also the section Specify fonts and colors for the Toggle Button's label text and Understand the states of the Toggle Button.

The modification should be done in your own ToggleButtonConfig object and then you assign your object to all the toggle buttons you want to use this configuration. Modifying the existing objects found in the unit WidgetSet is not the right way. See the section Modify provided default Toggle Button Config objects.

Does it help you?

Best regards

Paul Banach

by
Paul

Yes, that solves my problem.  I was not making my own config object.

Just one comment, instead of making ToggleButtonConfig object, which would mean I have to specify bit maps and everything for the switch,

I just copied Switch_Medium object, put in on the PageDefault, renamed it, and assigned it to Appearance of the ToggleButton1.  then changed the all the colours to black.   

 

Thank You

Robert

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...