UCanvasPanel::GetGeometryForSlot
#include "Components/CanvasPanel.h"
Access: public
Specifiers: const
Description
Computes the on-screen geometry (position and size) of a child slot based on the canvas panel's current arranged layout.
Caveats & Gotchas
- • SlotIndex is not bounds-checked — passing an out-of-range index hits a CastChecked assert instead of failing gracefully.
- • Returns false if the slot's Content is null or if the underlying native canvas widget hasn't been constructed yet, in which case ArrangedGeometry is left unmodified.
- • An overload taking a UCanvasPanelSlot* directly also exists; prefer it when you already have the slot pointer to avoid an index lookup.
Signature
bool GetGeometryForSlot(int32 SlotIndex, FGeometry& ArrangedGeometry) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| SlotIndex | int32 | Index of the child slot to compute arranged geometry for. | — |
| ArrangedGeometry | FGeometry& | Receives the computed geometry for the slot's content. | — |
Return Type
bool Example
Get a child's screen geometry C++
FGeometry SlotGeometry;
if (CanvasPanel->GetGeometryForSlot(0, SlotGeometry))
{
const FVector2D AbsolutePosition = SlotGeometry.GetAbsolutePosition();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?