DVUI

parentReset

Make a previous parent widget the current parent.

Pass the current parent's id. This is used to detect a coding error where a widget's .deinit() was accidentally not called.

Only valid between Window.beginand Window.end.

Parameters

#
id:Id
Id
prev_parent:Widget
Widget

Source

Implementation

#
pub fn parentReset(id: Id, prev_parent: Widget) void {
    const cw = currentWindow();
    const currentId = cw.current_parent.data().id;
    if (id != currentId) {
        log.err("widget is not closed within its parent. did you forget to call `.deinit()`?", .{});

        var iter = cw.current_parent.data().iterator();

        while (iter.next()) |wd| {
            log.err("  {s}:{d} {s} {x}", .{
                wd.src.file,
                wd.src.line,
                wd.options.name orelse "???",
                wd.id,
            });
            dvui.Debug.errorOutline(wd.rectScale().r);
        }
    }
    cw.current_parent = prev_parent;
}