Draw Line but under the widget (line z order?)

I’ve got the DrawLine working but I’m looking for a parameter or something to change the lines order.
As seen on screenshot below, I want the purple line to be under (covered by) the padlock widget. Is it possible?

lines

If you’re searching for a z-order, you can use from Add To Viewport blueprint of the padlock widget the Z-Order parameter. You need to use a higher value of the purple line. For example, when adding the padlock use as Z-Order 1 and for purple line 0.

My line is drawn in the same widget as the padlock. So, the only way is to draw the line in different widget than the padlock?

If it’s in the same widget then on the UI designer you just simply have to reorder the padlock or the line on “Hierarchy” Section.

Before:

After:

Widgets placed in a canvas use canvas zOrder:

image

Overlays utilise hierarchy order. Line drawing is different and draws on top of the same-widget hierarchy.


Make a User Widget whose job is to draw lines, add it to the canvas at the desired zOrder. It will then draw lines between the layers.

1 Like

What is this nonsense when I edit posts?!


What I wanted to add: the canvas creates slots for its widgets, each with a zOrder - you can access those slots and manipulate the order from BPs; it’s fully dynamic and works run-time.

1 Like

I believe all the responses were missing the point that this is using DrawLine. The line is not just another widget that you can reorder. It’s being drawn, most likely, from the OnPaint function.

@lordlolek, did you ever figure this out? I’m hitting a similar issue.

1 Like

Yeah, the solution is simple but kind of silly. Create a different Widget Blueprint with one job, which is drawing lines. Then add this blueprint to your main blueprint, and you can change its order and make it covered by other widgets.

However, if you want different lines with different Z-orders, you’ll need to create multiple widgets with lines.

If I were to do it now, I would create a generic widget blueprint called something like ‘WBP_LineDrawer’, where I could draw a single line or arrays of lines.

But honestly, for now, I try to avoid using draw lines in general because trying to make them draw in the right positions in nested widgets was driving me crazy.

1 Like

Ah, good to know. I’ll give this a try.

This is just for a prototype so It doesn’t need to be anything crazy, but I appreciate the warning.

Thanks. :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.