298 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

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

...