2023-09-12 03:26 AM
Hi Guys
been use to developing C and embedded ST nucleo boards,
now venturing in to touch gfx, must say seems very convoluted and hard work and very timely!
using touch gfx seems so long winded to do simple tasks with graphics ??
i'm using the designer to layout switches and the image widget for led display ie. image for red led off, red led on, green led off, green led on
so for switch1 putting these 4 led images in the designer on top of each other allows me to have 4 leds a red and green on /off
when i multiply this up for the next 7 switches the code to control all these led images gets really messy
what i would like is to create an array for the widgets so i can reference each led_red_off[1]= false;
I have no idea how to do this or whether its is even possible, but the thought of initialising all these image widgets can not be right ??
OUTPUT_ZONE1ViewBase::red_off_1a.setVisible(false);
OUTPUT_ZONE1ViewBase::red_off_2a.setVisible(false);
OUTPUT_ZONE1ViewBase::red_off_3a.setVisible(false);
OUTPUT_ZONE1ViewBase::red_off_4a.setVisible(false);
OUTPUT_ZONE1ViewBase::red_on_1a.setVisible(false);
OUTPUT_ZONE1ViewBase::red_on_2a.setVisible(false);
OUTPUT_ZONE1ViewBase::red_on_3a.setVisible(false);
OUTPUT_ZONE1ViewBase::red_on_4a.setVisible(false);
then the same for green, this is all so convoluted
how can i turn all the widget led images in to a array
thanks in advance for any help
2023-09-14 01:59 AM
Hello @JHERI ,
I'm sorry to hear you're struggling to start with TouchGFX. However, working with it is much simpler than you think. To answer your questions first, yes you can create an array to reference your images. You can put all your images and make them invisible through the designer.
Then you can create an array like " touchgfx::Image* LEDsForSwitch[4];" and then give the address of each image to the array "LEDsForSwitch[0] = &ImageOfLED". Then you can control them like "LEDsForSwitch[0]->setVisible(false)".
There are numerous examples and tutorials that can help you use TouchGFX conveniently. You can find them at:
https://support.touchgfx.com/docs/tutorials/tutorial-01
I hope this helps you