Display an error tooltip when same ID as HoveredId was submitted multiple times. See code in ItemHoverable() for an explanation of why we associate this error to HoveredId + code drawing of rectangles over individual items instances.
| 11187 | // Display an error tooltip when same ID as HoveredId was submitted multiple times. |
| 11188 | // See code in ItemHoverable() for an explanation of why we associate this error to HoveredId + code drawing of rectangles over individual items instances. |
| 11189 | void ImGui::ErrorCheckEndFrameFinalizeErrorTooltip() |
| 11190 | { |
| 11191 | #ifndef IMGUI_DISABLE_DEBUG_TOOLS |
| 11192 | ImGuiContext& g = *GImGui; |
| 11193 | if (g.DebugDrawIdConflictsId != 0 && g.IO.KeyCtrl == false) |
| 11194 | g.DebugDrawIdConflictsCount = g.HoveredIdPreviousFrameItemCount; |
| 11195 | if (g.DebugDrawIdConflictsId != 0 && g.DebugItemPickerActive == false && BeginErrorTooltip()) |
| 11196 | { |
| 11197 | Text("Programmer error: %d visible items with conflicting ID!", g.DebugDrawIdConflictsCount); |
| 11198 | BulletText("Code should use PushID()/PopID() in loops, or append \"##xx\" to same-label identifiers!"); |
| 11199 | BulletText("Empty label e.g. Button(\"\") == same ID as parent widget/node. Use Button(\"##xx\") instead!"); |
| 11200 | //BulletText("Code intending to use duplicate ID may use e.g. PushItemFlag(ImGuiItemFlags_AllowDuplicateId, true); ... PopItemFlag()"); // Not making this too visible for fear of it being abused. |
| 11201 | BulletText("Set io.ConfigDebugHighlightIdConflicts=false to disable this warning in non-programmers builds."); |
| 11202 | Separator(); |
| 11203 | if (g.IO.ConfigDebugHighlightIdConflictsShowItemPicker) |
| 11204 | { |
| 11205 | Text("(Hold Ctrl to: use "); |
| 11206 | SameLine(0.0f, 0.0f); |
| 11207 | if (SmallButton("Item Picker")) |
| 11208 | DebugStartItemPicker(); |
| 11209 | SameLine(0.0f, 0.0f); |
| 11210 | Text(" to break in item call-stack, or "); |
| 11211 | } |
| 11212 | else |
| 11213 | { |
| 11214 | Text("(Hold Ctrl to: "); |
| 11215 | } |
| 11216 | SameLine(0.0f, 0.0f); |
| 11217 | TextLinkOpenURL("read FAQ \"About ID Stack System\"", "https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#qa-usage"); |
| 11218 | SameLine(0.0f, 0.0f); |
| 11219 | Text(")"); |
| 11220 | EndErrorTooltip(); |
| 11221 | } |
| 11222 | |
| 11223 | if (g.ErrorCountCurrentFrame > 0 && BeginErrorTooltip()) // Amend at end of frame |
| 11224 | { |
| 11225 | Separator(); |
| 11226 | Text("(Hold Ctrl to: "); |
| 11227 | SameLine(0.0f, 0.0f); |
| 11228 | if (SmallButton("Enable Asserts")) |
| 11229 | g.IO.ConfigErrorRecoveryEnableAssert = true; |
| 11230 | //SameLine(); |
| 11231 | //if (SmallButton("Hide Error Tooltips")) |
| 11232 | // g.IO.ConfigErrorRecoveryEnableTooltip = false; // Too dangerous |
| 11233 | SameLine(0, 0); |
| 11234 | Text(")"); |
| 11235 | EndErrorTooltip(); |
| 11236 | } |
| 11237 | #endif |
| 11238 | } |
| 11239 | |
| 11240 | // Pseudo-tooltip. Follow mouse until Ctrl is held. When Ctrl is held we lock position, allowing to click it. |
| 11241 | bool ImGui::BeginErrorTooltip() |
nothing calls this directly
no outgoing calls
no test coverage detected