66 views
in GUI Development by

Hi,

Need some information to implement the textView dynamically.

If the x,y are coming  as Integer value from device side..

  1. Can we calculate the TextView with only x,y input.
  2. Using string Length and font size Text view dimension can be calculated

 

1 Answer

0 votes
by

Hello Pidea,

using string length and font size to calculate the text area is not reliable. This is because when rendering text individual glyph metrics and eventual kerning values are taken in account. This is true especially for the so-called proportional font. The best approach is to let Embedded Wizard calculate the size required for a concrete string.

For this purpose the Text view provides methods to calculate the area, the position, etc. of the entire displayed text block or a single text row. See the section: Arrange other views on the content of the Text view. You can perform the calculations also by using methods of the Resources::Font class. See the section: Reference for the Mosaic class Resources::Font.

To configure the position of the Text view dynamically, you use the view's property Bounds. Also possible, the position can be adjusted by modifying the view's property ScrollOffset.

I hope it helps you further.

Best regards

Paul Banach

by

hi Paul,

 

thanks for the reply,

1. Can I say that to  configure the position of the Text view dynamically, I have to use the view's property Bounds. . And In bounds four parameter are needed x1, x2, y1, and y2.

2. How to pass the parameter for bounds , I tried to experiment with following approach

var int32 x1 = 10;
var int32 x2 = 60;
var int32 y1 = 10;
var int32 y2 = 30;

Text.Bounds =  <x1 ,y1, x2, y2>;

 

by

Hi Pidea,

if you want to use variables, you should use the rect() instant constructor:

Text.Bounds = rect( x1, y1, x2, y2 );

Best regards,

Manfred.

by
got it thanks you for the same
by

Hi Manfred ,

One more Question 

https://ask.embedded-wizard.de/?qa=blob&qa_blobid=1381791798581957999

If I have  gui component that is changed dynamically by changing the bounds , so other widget like Text view1,  Text view2 and vertical list will be scaled automatically . Or i need to calculate and resize them manually.

by

Hi Pidea,

if your GUI component contains other views and you resize the GUI component, the views within your GUI component can be arranged automatically according to their layout constraints.

All other GUI components beside the one you resize will not arranged or scaled automatically - this have to be implemented according your needs.

Best regards,

Manfred.

by
sure noted thanks for the reply
by
hello Manfred,

Froms docs it is clear if we want to change the font size , we need to pass two paramter ascent and descent

height = ascent + descent.

Any possibility to change the font size of Text view dynamically by passing one paramter.

I read about the Row Distance but could not implement
by

Hello Pidea,

please note that Height is an attribute of the font resource - thus it cannot be changed during runtime. All attributes of a font resource have to be defined at design time. Changing the height (or other attributes) of a font resource, requires a new rasterization of the font. The rasterization of fonts is done during code generation (except you are using a True Type Font Engine within the target).

If you want to change the font used by your text views during runtime, you can prepare several font resources and select the font by using the property Font of your text views.

Best regards,

Manfred.

by
Changing the height can be done using True Type Font Engine within the target ?
by

In principle yes - with version 11.00 dynamically configured fonts can be used if the target provides a Platform Package with an external True Type Font Engine.

This is not available for Win32 or WebGL.

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

...