Z-order of Dynamic Controls

I have a window with 3 controls all bevel buttons…
TWO of them I want to be on the top of the visual stack
the third one has multiple instances created at runtime based on what the app is doing…
but in some situations a new dynamic instance covers one of the other two controls

Is there a way to send a dynammic control “to back” when it is instatianted??

the two buttons that need to be displayed are a PREV and NEXT the are used to scroll the list of the dynamic controls left and right if required

but if the LAST item exceeds the width… I still want as much of it to display as it can

I think that’s not possible. Xojo doesn’t support updating z-order.

In principle, a new control always comes on top.

On Windows there are declares to manipulate the z-order. I don’t know on Mac. It may be possible.

the two controls that need to stay on top are members of a second control set…
I have an idea to CLOSE the control and reinstantiate it after the other control set is situated.
I do not know if that will cause it to come to the top , or if it will retain its original z-order.
if that doesn’t work… I’ll encapuslate the controlset that changes inside another container or canvas (not exactly what I “want”, but if the first idea doesn’t work. perhaps that one will

Indeed, closing and reopening the controls in the desired order would work, although it will probably look busy.

The other idea would be to instantiate one or several controls early so they are behind, and make them invisible, then make them visible when needed.

Could have you the control set in a container and have a lower z-order on the container?

Z order fighting is nasty. I would suggest putting some logic in there to hide/show unneeded controls or use a “Page Panel”

Julian, there are no “unneeded controls”… every control that exists at any moment are “needed”…
It is a strip control with an arrow at each end, and a row of buttons in the middle
where the LAST of those buttons may need to be partially under the right side arrow

Adding an “inner” container should have worked, but it seems the “parent” kept disconnecting (or so it seemed)

made it work… here is the end result

Ahh, I was about to ask for a screen shot.

I’ve not heard of a strip control.

Glad you got it sorted :slight_smile:

This looks like something that could have been done with a Canvas…

yes it could have, but I opted for a Container Control and two controlsets of Bevel Buttons
this basically eliminated me having to deal with the “drawing” of the tabs, and just where they were positioned.

I’ve just had a play around with zorder in Windows, while I have had success changing the zorder of similar controls, it would seem Xojo renders the window in its own unique way (eg. it forces PushButtons to the front and not BevelButtons)

Indeed there are idiosyncrasies in Windows zorder. The worst one being that TextField get to front when the mouse hovers them.

But SetWindowPos does work.

On Mac seems there is no equivalent way to change zorder at run time. There is for apps, but I never saw anything for controls. Windows have orderFront and OrderBack, though.

Thats interesting. My new routines fix this problem, I can have a TextBox anywhere in the zorder and it stays there.

Hmm, not any more, it was a transient issue.

I might have a “bodge” to get text boxes working (i.e. not coming to the top)

See https://forum.xojo.com/38658-xojo-framework-z-order-backwards for the problem

Told you TextFields are not cooperating. They seem to have a life of their own.

Michel, see <https://xojo.com/issue/47001> and have a play around with attached project, the code in WindowsAPI.ZOrderFix should point you in the right direction. Try it on something small first, good luck.

Thank you Julian.