CloseCurrentParent()

Pops the parent stack and restores the previous parent element. This is essential for navigating the component hierarchy after creating nested containers.

Syntax
Result = MaterialSB::CloseCurrentParent(depth = 1)
Parameters
Parameter Description
depth (Optional) The number of levels to pop from the parent stack. Default is 1.
Return Value

Returns the new current parent element after popping the stack.

Remarks

The following components automatically push themselves onto the parent stack when created:

After adding content to these containers, call CloseCurrentParent() to return to the previous level. Use the depth parameter to close multiple levels at once.

Example
; Basic nesting with individual closes
MaterialSB::Row()
  MaterialSB::Col(12, 6, 4)
    MaterialSB::Card()
      MaterialSB::CardContent()
        MaterialSB::Append(MaterialSB::Paragraph("Card content here"))
      MaterialSB::CloseCurrentParent()  ; Close CardContent
    MaterialSB::CloseCurrentParent()    ; Close Card
  MaterialSB::CloseCurrentParent()      ; Close Col
MaterialSB::CloseCurrentParent()        ; Close Row

; Using depth parameter to close multiple levels
MaterialSB::Row()
  MaterialSB::Col(12)
    MaterialSB::Append(MaterialSB::Header("Title", 3))
  MaterialSB::CloseCurrentParent(2)     ; Close both Col and Row at once
See Also

SetCurrentParent(), GetCurrentParent(), Row(), Col()