Skip to main content
V.H
Senior
August 11, 2022
Solved

Issue: Widget overwritten.

  • August 11, 2022
  • 1 reply
  • 1071 views

Hi,

For example, I create 2 widgets (button and box), the box in top and button in bottom.

I need to change their position like picture 2, how can I do except delete and rebuild to changed their order ?

0693W00000QNRVaQAP.png 

0693W00000QNRVkQAP.png

This topic has been closed for replies.
Best answer by Yoann KLEIN

Hello,

Unfortunately this function is not implemented in the API.

But, there is a little work-around you can use if you want to do that :

  • First, programmatically remove your widget from your container (in your case, the Screen)
  • Then, insert your widget before/after the other widget to show it on foreground or background on your interface

The code could look like that :

void Screen1View::changeWidgetPosition()
{
 remove(box1);
 insert(&button1, box1); // insert the box below the button
}

/Yoann

1 reply

Yoann KLEIN
ST Employee
August 12, 2022

Hello @V.H​ ,

In the Screens menu, you can simply right click on the widget you want to put on foreground, and then select the "Move Up" option :

0693W00000QNYdaQAH.pngPlease not that you can also do the same with background, if you select "Move Down".

Hope that this answers the question,

/Yoann

Yoann KLEINST Software Developer | TouchGFX
V.H
V.HAuthor
Senior
August 12, 2022

Thanks for your reply.

Does the API have this function? I want to do this movement in the firmware.

Yoann KLEIN
Yoann KLEINBest answer
ST Employee
August 15, 2022

Hello,

Unfortunately this function is not implemented in the API.

But, there is a little work-around you can use if you want to do that :

  • First, programmatically remove your widget from your container (in your case, the Screen)
  • Then, insert your widget before/after the other widget to show it on foreground or background on your interface

The code could look like that :

void Screen1View::changeWidgetPosition()
{
 remove(box1);
 insert(&button1, box1); // insert the box below the button
}

/Yoann

Yoann KLEINST Software Developer | TouchGFX