722 views
in GUI Development by
Hi,

    I have added color property   in textkey47 button thorough loadlayoutstring method. when run the code property is not applied.

 can you please guide me to resolve this.

1 Answer

0 votes
by

Hi Ramesh,

I assume you want to colorize the text of the textkey47 different than at the other key buttons.

The color of the text is assigned within ExtendedVirtualKeyboard::Button.UpdateViewState():

textView.Color = Appearance.TextColor;

This does overwrite the assignment you make at loadLayoutFromString().

What you could do, is that you add an additional bool property at the ExtendedVirtual::Button e.g. call it SpecialColor. Set it inside the inspector on textkey47 to true. As a default it should be false. Than call inside OnSetSpecialColor InvalidateViewState() to request an UpdateViewState() call. Inside UpdateViewState() you can now check on this property to set for example the text color of textkey47 to red:

if ( textView != null )
{
  textView.String = String;
  textView.Font = Appearance.Font;
  textView.Color = Appearance.TextColor;

  if ( SpecialColor )
    textView.Color = #FF0000FF; // Set the text color to red
}

Regards,

Julian

 

by
Thank you for your guidenance.

I am not able to change font height in Textkey47

please help to resolve this.

 

With Regards,

Ramesh.G
by

Hi Ramesh,

in general displaying glyphs with different height requires additional font resources. Be aware that especially in this case due to the huge font range this can result in a lot of additional flash memory. If thats not a problem for you than you can do the following:

1. Create a new font resource e.g. ExtendedVirtualKeyboard::FontL and make sure that its proper setup like ExtendedVirtualKeyboard::FontM but with different Height

2. Also do an exception for the font at ExtendedVirtualKeyboard::Button.UpdateViewState() by changing it the following way:

if ( textView != null )
{
  textView.String = String;
  textView.Font = Appearance.Font;
  textView.Color = Appearance.TextColor;

  if ( SpecialColor )
  {
    textView.Color = #FF0000FF; // Set the text color to red
    textView.Font = ExtendedVirtualKeyboard::FontL;
  }
}
Regards,
Julian

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...