# Is there a way to set a z-order for buttons?

**URL:** <https://forum.inductiveautomation.com/t/is-there-a-way-to-set-a-z-order-for-buttons/6952>\
**Category:** Ignition\
**Created:** [July 31, 2013, 1:25am UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-set-a-z-order-for-buttons/6952 "2013-07-31T01:25:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bob/32/16899_2.png) [@Bob](https://forum.inductiveautomation.com/u/Bob)\
**Post date:** [July 31, 2013, 1:25am UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-set-a-z-order-for-buttons/6952/1 "2013-07-31T01:25:15Z")

</div>

I have an image with buttons on top of it. I am resizing/redrawing the image, but then the buttons are behind the image. Is there a way to keep the buttons in the foreground without having to re-add them to the window?

---

<div class="post-metadata">

**Author:** ![markdobtech](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@markdobtech](https://forum.inductiveautomation.com/u/markdobtech)\
**Post date:** [July 31, 2013, 5:50pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-set-a-z-order-for-buttons/6952/2 "2013-07-31T17:50:54Z")

</div>

You can use setComponentZOrder() on the window root container and apply a z-order to components within the root container. If you do this, you must apply a z-order to all of the components in the root container.

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [July 31, 2013, 6:40pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-set-a-z-order-for-buttons/6952/3 "2013-07-31T18:40:24Z")

</div>

You can also move the component to the front of the Z order in the designer  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/4cba1b293145c28a8ae0a46dfac5206c8d626b6e.PNG)

---

<div class="post-metadata">

**Author:** ![Bob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bob/32/16899_2.png) [@Bob](https://forum.inductiveautomation.com/u/Bob)\
**Post date:** [July 31, 2013, 7:36pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-set-a-z-order-for-buttons/6952/4 "2013-07-31T19:36:24Z")

</div>

I have a test with the setComponentZOrder() that seems like it will work for me.

Greg, since I have many buttons (300) predefined but they are all set to invisible and only shown at runtime as needed, if I move them to the front in the designer, will they still always be in the front even though the visible property is being toggled at runtime? If you aren’t sure, I will test it.

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [July 31, 2013, 9:39pm UTC](https://forum.inductiveautomation.com/t/is-there-a-way-to-set-a-z-order-for-buttons/6952/5 "2013-07-31T21:39:48Z")

</div>

Yes, they will still be in the front of the Z order, you are just toggling the visibility.
