Move to front code

I have a popupmenu that is initially hidden but becomes visible when a button is pressed. For decoration, there is a rectangle behind it at the back, but when the menu becomes visible it is displayed behind the rectangle. Is there any code I can write or any other way to move the rectangle to the back? I can put it in the button’s code. Thanks!

Can you add screenshots and some code? What platform do you use?

In Xojo you can’t change the z-order of controls. For what do you need the rectangle? Can you make it invisible?

The rectangle is for decoration and needs to be behind the menu at all times
I am using Xojo Windows (3.1 I think?)

Draw the rectangle to the window’s graphics in the paint event, rather than using a control.

or use a ContainerControl, put your PopupMenu in and use the Paint Event of the CC for your Rectangle Background.
then use this ContainerControl in the Window.