Skip to main content

Floating

A floating element is taken out of the normal flow and drawn on top, attached to its parent, the window, or any element by id. Use it for tooltips, menus and modals. A higher zIndex draws on top.

Example​

static void help_tooltip(void) {
Row("Help", .layout = { .padding = PadAll(4) }) {
Text("?");
if (CC_Hovered("Help")) {
Column("Tip", .floating = FloatOnParent(100),
.layout = { .padding = PadAll(8) },
.backgroundColor = ColorHex(0x333333)) {
Text("Shown while hovering", .fontSize = 12);
}
}
}
}

Reference​

NameFormWhat it doesPage
FloatOnParent.floating = FloatOnParent(z)Float over the parent at z-index z.Floating
FloatOnRoot.floating = FloatOnRoot(z)Float over the whole window at z-index z.Floating
CC_ATTACH_TO_*NONE, PARENT, ELEMENT_WITH_ID, ROOTValues for .floating.attachTo.Floating
CC_ATTACH_POINT_*LEFT_TOP … RIGHT_BOTTOM (9 values)Values for .floating.attachPoints.element and .parent.Floating