place a widget's child always on top?

hi,

is there a way to draw a widget’s child always on top of other child/layer?

it can be that during time, some other layers will be added as children, after that particular widget. i need to place this particular widget always on top. any way, you know?

thanks for any tips

You can move a widget from one parent to another.

use removeChild and then addChild

or if they should all have the same parent, there are addChildBelow and addChildAbove methods.

all in the Widget class

Of course, but I don’t have control of other widgets, just mine. So if I do addChild at time 0, and later some others actors add child to the same widget, mine is covered…

Is there somethings I can do from within my child?

You can find the parent of your widget

widget->parent

Then remove your widget from the parent, and add it back in. That will leave your widget as the topmost child.

1 Like

it seems this could be the correct way to deal with.

problem is that “cable container” is on top of most of the widgets. so a cable will cover a widget on the same zone.

is there any “usable container” on top of cables container?

There’s not really anything up there that you should be using.

I think it would be difficult to put anything up there. Normally widgets are responsible for their children. So when your module is deleted from the rack, all of it’s child widgets should get cleaned up. If you go sticking widgets into other containers, then you need to be absolutely sure that you can remove them again and dispose of them correctly before they try to access anything that’s been deleted.

2 Likes

If you want to display a custom context menu, it will always be on top of everything.

What exaxtly do you want to do?

Maybe something similar already exists in the VCV API or in an open-source module.

place a led on top of a wdiget (which can be a knob, a port, a display, whatever).

the problem is that some widget can have an additional layer over it (i.e. ports with cable), and the led should be always on top of them.

From my perspective, the only problem can occour by placing an LED on top of a port-widget. But a port-widget already has an LED inside, that emits light when connected by a cable, depending on the voltage passing the port/cable.

What about placing the LED beneath the port-widget or placing a large LED under the port-widget to create an illuminated ring around the port?

the problem is that some port-widget on some modules are “smaller” than the cable ring size. so place a ring around it won’t be visibile, because will be behind the cable on top (which can be larger)…

It’s up to you to make your port-widgets on your own modules larger than the cable ring size.

But if you really want to put a widget on top of a cable-widget, maybe take a look at the sourcecode of ME by Stoermelder: