370 views
in Embedded Wizard Studio by

Hi all,

I have two strings "ADDWWWQQAZXC" (str1) & "ABCDEFGHIJKL" (str2)

Both of them have same length.

you can see bleow pictures

    

Although their length are the same, str1 exceeds the blue border but str2 doesn't exceed the blue border

Is there any way I can know the real length of string not just the character number ?

If the string exceeds the blue border , I will enable the scrolling text function.

I can't judge with the length of string.

Is there any way I can implement it?

Thanks!

 

Best Regards,

Andy Dong

1 Answer

0 votes
by
 
Best answer

Hallo Andy,

even though your two strings have the same string length, the resulting text views have a different text width, because you are using a proportional font.

If you want to determine the resulting area that a certain string needs to be shown by using a certain font, you can use the method GetTextExtent() of the class Resources::Font.

This method returns a rect that you can compare with the available area.

Best regards,

Manfred.

by
Hi Manfred,

I am not sure is it ok to ask another problem here ?

I want to control all the color of objects(text, background, border etc.) together when I change the mode (DAY / NIGHT)

Is there a best way to implement it ?

Thanks!

 

Best Regards,

Andy
by

Hi Andy,

in principle it would be better to open a new question, because it is not related to the topic "the real length of strings"...

Nevertheless, let me recommend to have a look on the chapter Managing variants - especially the section dynamic variants. This unique feature of Embedded Wizard is ideal to create different skins of your GUI application.

Best regards,

Manfred.

by
Hi Manfred,

Thank you so much!!

Best Regards,

Andy

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

...