Skip to main content
JReed.1856
Associate II
November 25, 2019
Question

Set Text without designer

  • November 25, 2019
  • 11 replies
  • 2453 views

Is it possible to create a Text without ueing the Designer first? Seems like everything has to be done through the Text Manager.​

This topic has been closed for replies.

11 replies

Martin KJELDSEN
Principal III
November 29, 2019

You can simply edit the Excel sheet - That's what the designer does. It reads from- and writes to that text excel sheet and you can use this approach if you're not using the designer, for instance.

/Martin

JReed.1856
Associate II
November 29, 2019

Hi Martin,

I tried to do it that way, defining a text ID and Typography, and <value> as text. Wildcard Characters and Ranges have all been set. Trying to put it on screen like this:

 xDivText.setPosition(400, 240, 100, 50);
	Unicode::snprintf(txtBuffer, 7, "1 %d", 4000);
	xDivText.setTypedText(TypedText(T_GRAPHMINI));
	xDivText.setColor(Color::getColorFrom24BitRGB(0xFF, 0xFF, 0xFF));
	xDivText.setWildcard(txtBuffer);
	swipeContainer1Page1.add(xDivText);
	xDivText.resizeToCurrentText();
	xDivText.invalidate();

results in nothing being displayed.

The aim is to get axis labels on screen, without having to provide every single text area beforehand.

Martin KJELDSEN
Principal III
November 29, 2019

Dumb question, but you're adding it to swipeContainer1Page1. Is that page visible? (E.g. is swipeContainer1Page1 visible?) :)

JReed.1856
Associate II
November 29, 2019

Yep, I've added other widgets to it, and they're displayed fine

Martin KJELDSEN
Principal III
November 29, 2019

When you're setting the position of the textarea to 400,240 it will be relative to the container it's in. So, it may be outside =) And you're already using .resizeToCurrentText(), so try

xDivText.setXY(20,20);
...
...
xDivText.resizeToCurrentText();

Martin KJELDSEN
Principal III
November 29, 2019

Or alternatively, don't call resizeToCurrentText();

Try debugging and inspecting the xDivText object. You can inspect its Rect and check width and height, etc.

JReed.1856
Associate II
November 29, 2019

Ok so getSolidRect() on the textArea yields x,y, width and height all 0 without using resize

Martin KJELDSEN
Principal III
November 29, 2019

Does T_GRAPHMINI specify a wildcard character?

Martin KJELDSEN
Principal III
November 29, 2019

You could also simply send me the project and i'll check.

/Martin

JReed.1856
Associate II
November 29, 2019

Sorry, I don't think I can send you the entire project. T_GRAPHMINI is one of the enums in TextKeysandLanguage.hpp, he corresponding Translation in the excel sheet is GraphMini with Typography Mini