cancel
Showing results for 
Search instead for 
Did you mean: 

Issue: Widget overwritten.

V.H
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions

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 KLEIN
ST Software Developer | TouchGFX

View solution in original post

3 REPLIES 3
Yoann KLEIN
ST Employee

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 KLEIN
ST Software Developer | TouchGFX

Thanks for your reply.

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

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 KLEIN
ST Software Developer | TouchGFX