Skip to main content
Artur Vieira
Associate III
November 27, 2019
Solved

Change Object Z-Order

  • November 27, 2019
  • 2 replies
  • 1464 views

Hi

Is there any way to change an object "z-order" via code?

Using the designer is easy, just click the button "Send backwards" and "Bring forward", this basically change in the "ViewBase.cpp" the order of adding the object to the screen.

Is there any way to do this after, for any object we add (in "setupScreen" function)?

Use Case: I have a page with some buttons to perform some actions, but would like that if the user press anywhere on the screen (that is not a button) to execute an action (change page), for that i am using a touchArea that i have to add manually, but since it is always the last object added it stays in front of other objects and captures the click for the buttons.

Thank You

This topic has been closed for replies.
Best answer by COSEBE

Hi,

Just call remove(windget_you_want_in_front) and add this widget again with add(windget_you_want_in_front)

Sébastien

2 replies

COSEBE
COSEBEBest answer
Senior
November 27, 2019

Hi,

Just call remove(windget_you_want_in_front) and add this widget again with add(windget_you_want_in_front)

Sébastien

Artur Vieira
Associate III
November 27, 2019

Hi

thanks for the tip... yeah, simple and it works.

Just need to remember if i add more objects in the designer to update the function to remove them and add them after the toucharea.

Thanks