From 14b4d8a625f525ed85f81675e66083d2ccaae015 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 23 Feb 2026 22:36:23 +0100 Subject: [PATCH] Clipper: added UserIndex helper storage. --- docs/CHANGELOG.txt | 5 ++++- imgui.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 31fb4710a..941e5aa69 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -50,7 +50,10 @@ Breaking Changes: Other Changes: - Style: border sizes are now scaled (and rounded) by ScaleAllSizes(). -- Clipper: clear DisplayStart/DisplayEnd fields when Step() returns false. +- Clipper: + - Clear `DisplayStart`/`DisplayEnd` fields when `Step()` returns false. + - Added `UserIndex` helper storage. This is solely a convenience for cases where + you may want to carry an index around. - Examples: - Emscripten: added `tabindex=-1` to canvas in our shell_minimal.htm. Without it, the canvas was not focusable in the DOM, which in turn make some backends diff --git a/imgui.h b/imgui.h index dea4bc0bc..a0b4c3686 100644 --- a/imgui.h +++ b/imgui.h @@ -2853,6 +2853,7 @@ struct ImGuiListClipper ImGuiContext* Ctx; // Parent UI context int DisplayStart; // First item to display, updated by each call to Step() int DisplayEnd; // End of items to display (exclusive) + int UserIndex; // Helper storage for user convenience/code. Optional, and otherwise unused if you don't use it. int ItemsCount; // [Internal] Number of items float ItemsHeight; // [Internal] Height of item after a first step and item submission can calculate it double StartPosY; // [Internal] Cursor position at the time of Begin() or after table frozen rows are all processed