Skip to main content
Nikunj Patel
February 19, 2020
Question

I would like to change the "Image of Image widget" on receiving the different status

  • February 19, 2020
  • 2 replies
  • 627 views

Hello All,

I am using "STM32746G-DISCO" Kit.

I am using the "Image widget" to display the image.

I would like to change the "Image" on fix location on receiving the "CONNECT" & "DISCONNECT" status.

I am using two different Image for CONNECT & DISCONNECT.

Can you please guide me how do i update the image on receiving the "CONNECT" & "DISCONNECT" Status.

I am using following API but when it run, It freeze the GUI.

if(status == 1)

{

image1.setXY(3.76);

Image1.SetBitmap(Bitmap(BITMAP_CONNECTED_ID));

add(Image1);

}

else if(status == 2)

{

image1.setXY(3.76);

Image1.SetBitmap(Bitmap(BITMAP_DISCONNECTED_ID));

add(Image1);

}

please, Do needful for me.

Regards,

Nikunj Patel

This topic has been closed for replies.

2 replies

Alexandre RENOUX
February 19, 2020

Hello,

Your image widget should already be added to your screen in the generated code.

When you want to change the image, you invalidate the changed area so that TouchGFX knows that it has to render and redraw this area.

Instead of writing add(Image1), write image1.invalidate()

Nikunj Patel
February 19, 2020

Hello @Alexandre RENOUX​ 

Thanks for guidance, Now it is working for me.

Regards,

Nikunj Patel