Skip to main content
yldzmuhammed
Associate III
June 12, 2020
Question

TouchGFX Level Indicator

  • June 12, 2020
  • 3 replies
  • 1018 views

Hello,

I want to add to my project some level indicator like battery level, wifi level, gsm signal rssi level etc.

Is there a way to do it with touchgfx without add an image for each level?

This topic has been closed for replies.

3 replies

Martin KJELDSEN
Principal III
June 12, 2020

Sure, if you think about it - You could have a "foreground" image that has full alpha for the parts of the image where the levels are supposed to be. Then, behind that image, you'll move a simple "Box" up, or sideways, or however you want it to fill those holds, letting the Box become visible where because of the alpha in the image on top.

Imagine this pseudo code for a battery gauge with "levels".

batteryLevel.increase(1);
..
 
Battery::init()
{
 //define box
 add(box);
 
 //define top bitmap with alpha
 add(top);
}
 
Battery::increase(uint8_t _level)
{
 box.moveRelative(box.getX(), -20 * level); //Moves image up, 20px = 1 level.
}

 You could do a battery indicator that is just a linear gauge too. Lots of options.

/Martin

yldzmuhammed
Associate III
June 12, 2020

It is not clear. Is there a guide or something like that?

Martin KJELDSEN
Principal III
June 12, 2020

This is just application development - You have to sort of envision the possibilities since it's impossible for us to cover every possible scenario (both in terms of widgets and guides). Start by sharing some graphics that show how you want these indicators to look and i'll point you in the right direction :)

/Martin