cancel
Showing results for 
Search instead for 
Did you mean: 

REPOST: How can I put a value into Wildcard ?

QUESTION - TouchGFX Community repost - JPike - March 2017

Hello,

Im trying to put a value in to a TextwithWildcard widget to show the ADC value onto the screen. But I cannot get it work. I tried to follow the text_example.

My custom function I put in the file Test_screen_1View.cpp (I have the function included in the .hpp file)

oid Test_screen_1View::updateWildcard()
{
 Unicode::snprintf(test_val_1Buffer,5,"%d",155);
 test_val_1.invalidate();
}

And the code which TouchGFX Designer generated for me in the file Test_screen_1ViewBase.cpp

#include <gui_generated/test_screen_1_screen/Test_screen_1ViewBase.hpp>
#include <touchgfx/Color.hpp>
#include <texts/TextKeysAndLanguages.hpp>
#include "BitmapDatabase.hpp"
 
Test_screen_1ViewBase::Test_screen_1ViewBase() :
 buttonCallback(this, &Test_screen_1ViewBase::buttonCallbackHandler)
{
 box1.setPosition(0,0,480,272);
 box1.setColor(touchgfx::Color::getColorFrom24BitRGB(255,255,255));
 
test_val_1.setXY(163, 123);
 test_val_1.setColor(touchgfx::Color::getColorFrom24BitRGB(0,0,0));
 test_val_1.setLinespacing(2);
 test_val_1.setTypedText(TypedText(T_TEXTID1));
 test_val_1Buffer[0] = 0;
 test_val_1.setWildcard(test_val_1Buffer);
 
button1.setPosition(155, 212, 170, 60);
 button1.setBitmaps(Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_SMALL_ID), Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_SMALL_PRESSED_ID));
 button1.setAction(buttonCallback);
 add(box1);
 add(test_val_1);
 add(button1);
}
 
void Test_screen_1ViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
 if (&src == &button1)
 {
 //Interaction1
 //When button1 clicked change screen to Test_screen_2
 //Go to Test_screen_2 with slide screen transition towards East
 application().gotoTest_screen_2ScreenSlideTransitionEast();
 }
}

Can anyone help me this problem. Do I have to modify anymore file? I cannot figure it out. My graduation project deadline id coming :(

ANSWER - TouchGFX Community repost - Soren Pingel Dalsgaard - March 2017

Hi there,

My initial guess would be that you have the "auto-size" checkbox checked in the Designer properties for your TextAreaWithWildcard.

The Designer does not know about your code addition that causes the length of the string to increase - therefore auto-size does not really work in this case. This is counterintuitive, I know.

Anyway to fix it, try deselecting autosize and give the widget an appropriate width large enough to also cover the wildcard string.

ANSWER - TouchGFX Community repost - Mirko Mancin - March 2017

Hi, I have the same problem. I can't update text into textArea with wildcard. My snippet is the follow:

int16_t value = 123;

Unicode::snprintf(textAreaBuffer, 4, "%d", value);

textArea.invalidate();

But display cannot update. There is always set the default text. I drill-down the code and maybe, the wildcard is not correctly link with text (textarea uses always typedtext??)

Thanks

ANSWER - TouchGFX Community repost - Jesper Hedegaard - March 2017

Things to consider&try:

-Does your text have a wildcard slot in it, like for example "My value <value>".

-Is the textAreaBuffer used as the wildcard for the textArea? Have you called textArea.setWildcard(textAreaBuffer); (if you are using the designer it should be)

-Is the size of the textArea correct. You could try to add a textArea.resizeToCurrentText() before your textArea.invalidate().

-Have you added the characters that you insert in the wildcard. You need these in the typography used for the textArea. You can use the "Wildcard Characters" or "Wildcard range" in the typography sheet for this. See https://touchgfx.zendesk.com/hc/en-us/articles/207015345-Using-texts-and-fonts for more info on this

ANSWER - TouchGFX Community repost - Mirko Mancin - March 2017

Ok. Now working. I forgot to enter values into typography tab into xlsx. I had insert previously insert all that you tell me but I had not insert charset for wildcard.

Thank you

0 REPLIES 0