Skip to main content
JReed.1856
Associate II
Nov 25, 2019 5:30 PM UTC
Question

Set Text without designer

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.

17 replies

Martin KJELDSEN
Principal III
Nov 29, 2019 7:24 AM UTC

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
Nov 29, 2019 12:19 PM UTC

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
Nov 29, 2019 1:27 PM UTC

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

JReed.1856
Associate II
Nov 29, 2019 1:32 PM UTC

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

Martin KJELDSEN
Principal III
Nov 29, 2019 1:35 PM UTC

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
Nov 29, 2019 1:38 PM UTC

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
Nov 29, 2019 1:52 PM UTC

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

Martin KJELDSEN
Principal III
Nov 29, 2019 1:55 PM UTC

Does T_GRAPHMINI specify a wildcard character?

Martin KJELDSEN
Principal III
Nov 29, 2019 1:56 PM UTC

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

/Martin

JReed.1856
Associate II
Nov 29, 2019 2:22 PM UTC

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