ImGui::BeginTooltip() should allow specifying override #7570

Open
opened 2024-05-09 15:06:09 +00:00 by DanielGibson · 0 comments
DanielGibson commented 2024-05-09 15:06:09 +00:00 (Migrated from github.com)

Version/Branch of Dear ImGui:

1.90.6

Back-ends:

All

Compiler, OS:

All

Full config/build information:

No response

Details:

ImGui::BeginTooltipEx() (which is only available through imgui_internal.h) allows specifying if one wants to override a current tooltip or, which is the default, extend it.

The regular ImGui::BeginTooltip() always extends existing tooltips, while the (also publicly exposed) ImGui::SetTooltip() always sets the override flag (which BTW is contradicting to the documentation/comments, which says "SetTooltip() is a shortcut for the 'if (BeginTooltip()) { Text(...); EndTooltip(); }' idiom.").

I think it would be useful if one could specify if an existing tooltip should be overridden or if it should be extended.

This could be done without breaking API-backwards-compat with
bool BeginTooltip( bool overridePrevious = false )
or by moving ImGuiTooltipFlags to the public imgui.h and using
bool BeginTooltip( ImGuiTooltipFlags = ImGuiTooltipFlags_None )

For SetToolTip() this might also be useful, but there it can't be done without breaking the API, because of the varargs.


By the way, the text above says

Ask any question, discuss best practices, report a bug, request a feature. If this doesn't look right, choose a different type.

but as far as I can tell there is no way to choose a different type (Feature Request would probably be more appropriate), only this issue form.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

### Version/Branch of Dear ImGui: 1.90.6 ### Back-ends: All ### Compiler, OS: All ### Full config/build information: _No response_ ### Details: `ImGui::BeginTooltipEx()` (which is only available through imgui_internal.h) allows specifying if one wants to override a current tooltip or, which is the default, extend it. The regular `ImGui::BeginTooltip()` always extends existing tooltips, while the (also publicly exposed) `ImGui::SetTooltip()` always sets the override flag *(which BTW is contradicting to the documentation/comments, which says "SetTooltip() is a shortcut for the 'if (BeginTooltip()) { Text(...); EndTooltip(); }' idiom.").* I think it would be useful if one could specify if an existing tooltip should be overridden or if it should be extended. This could be done without breaking API-backwards-compat with `bool BeginTooltip( bool overridePrevious = false )` or by moving `ImGuiTooltipFlags` to the public imgui.h and using `bool BeginTooltip( ImGuiTooltipFlags = ImGuiTooltipFlags_None )` For `SetToolTip()` this *might* also be useful, but there it can't be done without breaking the API, because of the varargs. ---- By the way, the text above says > Ask any question, discuss best practices, report a bug, request a feature. If this doesn't look right, choose a different type. but as far as I can tell there is no way to choose a different type (Feature Request would probably be more appropriate), only this issue form. ### Screenshots/Video: _No response_ ### Minimal, Complete and Verifiable Example code: _No response_
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#7570
No description provided.