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.
| 11111 | // Display an error tooltip when same ID as HoveredId was submitted multiple times. |
| 11112 | // See code in ItemHoverable() for an explanation of why we associate this error to HoveredId + code drawing of rectangles over individual items instances. |
| 11113 | void ImGui::ErrorCheckEndFrameFinalizeErrorTooltip() |
| 11114 | { |
| 11115 | #ifndef IMGUI_DISABLE_DEBUG_TOOLS |
| 11116 | ImGuiContext& g = *GImGui; |
| 11117 | if (g.DebugDrawIdConflictsId != 0 && g.IO.KeyCtrl == false) |
| 11118 | g.DebugDrawIdConflictsCount = g.HoveredIdPreviousFrameItemCount; |
| 11119 | if (g.DebugDrawIdConflictsId != 0 && g.DebugItemPickerActive == false && BeginErrorTooltip()) |
| 11120 | { |
| 11121 | Text("Programmer error: %d visible items with conflicting ID!", g.DebugDrawIdConflictsCount); |
| 11122 | BulletText("Code should use PushID()/PopID() in loops, or append \"##xx\" to same-label identifiers!"); |
| 11123 | BulletText("Empty label e.g. Button(\"\") == same ID as parent widget/node. Use Button(\"##xx\") instead!"); |
| 11124 | //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. |
| 11125 | BulletText("Set io.ConfigDebugHighlightIdConflicts=false to disable this warning in non-programmers builds."); |
| 11126 | Separator(); |
| 11127 | if (g.IO.ConfigDebugHighlightIdConflictsShowItemPicker) |
| 11128 | { |
| 11129 | Text("(Hold Ctrl to: use "); |
| 11130 | SameLine(0.0f, 0.0f); |
| 11131 | if (SmallButton("Item Picker")) |
| 11132 | DebugStartItemPicker(); |
| 11133 | SameLine(0.0f, 0.0f); |
| 11134 | Text(" to break in item call-stack, or "); |
| 11135 | } |
| 11136 | else |
| 11137 | { |
| 11138 | Text("(Hold Ctrl to: "); |
| 11139 | } |
| 11140 | SameLine(0.0f, 0.0f); |
| 11141 | TextLinkOpenURL("read FAQ \"About ID Stack System\"", "https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#qa-usage"); |
| 11142 | SameLine(0.0f, 0.0f); |
| 11143 | Text(")"); |
| 11144 | EndErrorTooltip(); |
| 11145 | } |
| 11146 | |
| 11147 | if (g.ErrorCountCurrentFrame > 0 && BeginErrorTooltip()) // Amend at end of frame |
| 11148 | { |
| 11149 | Separator(); |
| 11150 | Text("(Hold Ctrl to: "); |
| 11151 | SameLine(0.0f, 0.0f); |
| 11152 | if (SmallButton("Enable Asserts")) |
| 11153 | g.IO.ConfigErrorRecoveryEnableAssert = true; |
| 11154 | //SameLine(); |
| 11155 | //if (SmallButton("Hide Error Tooltips")) |
| 11156 | // g.IO.ConfigErrorRecoveryEnableTooltip = false; // Too dangerous |
| 11157 | SameLine(0, 0); |
| 11158 | Text(")"); |
| 11159 | EndErrorTooltip(); |
| 11160 | } |
| 11161 | #endif |
| 11162 | } |
| 11163 | |
| 11164 | // Pseudo-tooltip. Follow mouse until Ctrl is held. When Ctrl is held we lock position, allowing to click it. |
| 11165 | bool ImGui::BeginErrorTooltip() |
nothing calls this directly
no outgoing calls
no test coverage detected