Use HorizontalSlider change Text color

29 views
asked Jan 21 in Embedded Wizard Studio by Tonny

 Hello,

      Based on example:WaveformGenerator.

      I want to use HorizontalSlider change Text color.

     Now,i have two Text(Text1 and Text2),and two HorizontalSlider(HorizontalSlider1 and HorizontalSlider2).

    

     When i slide one of the HorizontalSlider(HorizontalSlider1),The Text change the Value,and i want to change the color,so that i can know which one HorizontalSlider I changed.I just want to know one of the changes I made and show it . 

           

Best regards,

Tonny.            

1 Answer

0 votes
answered Jan 21 by Manfred Schweyer

Hi Tonny,

in this case you can add a slot method and connect it with the OnChange property of the HorizontalSlider. This means, each time you change the position of the slider, your slot method will be called.

Within this slot method, you can implemenet your desired logic to colorize the text (or to do any other things).

For example:

var uint8 red = (uint8)HorizontalSlider.CurrentValue;

var uint8 green = 0x00; /* or some other value */

var uint8 blue = 0x00; /* or some other value */

Text.Color = color( red, green, blue, 0xFF );

If you only want to change the color while the user is interacting with the slider, you can use the sliders OnStart and OnEnd slot methods and connect them with two slot methods - one to highlight the text and the other one to restore the previous color.

Does this answer your question?

Best regards,

Manfred.

commented Jan 21 by Tonny

Hello Manfred,

       I did what you wanted me to do,Why still not ??Did I make a mistake?When i press F7,the Text is not display!!

Thanks!

Best regards,

Tonny

commented Jan 21 by Manfred Schweyer

Hi Tonny,

maybe there is an error reported wihtin the Log Window? Or maybe the red value is 0 => then you have black text over black background. You can set green = 0xFF. Does it appear?

Best regards,

Manfred.

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

...