You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My Issue/Question:
I would like to use the _Disabled flag, but would also like to give the user feedback on why an item is disabled. When ItemHovered() sees that the item you're checking has ImGuiItemFlags_Disabled, it always returns false. This makes it harder (workaround is possible of course) to show a tooltip and/or provide more feedback.
I understand that the _Disabled flag is WIP functionality which is why I brought it up here first for review instead of opening a pull request.
After a few tests, I didn't spot unintended behavior after removing the check for _Disabled from ItemHovered(), but then I wasn't sure if it should also be removed from ItemHoverable() for "consistencies' sake". I didn't see any comments/issues discussing this, so I wanted to ask here if anybody knows any good reason to keep the code as is.
Standalone, minimal, complete and verifiable example:
ImGui::SetDisabled();
ImGui::Button("Blocked Action");
if (ImGui::IsItemHovered())
{
// Never happens ;(
ImGui::SetTooltip("This Action is Blocked because _bla_bla_");
}
ImGui::UnsetDisabled()
The offending(?) code:
bool ImGui::IsItemHovered(ImGuiHoveredFlags flags)
{
...
// Test if the item is disabled
if (window->DC.ItemFlags & ImGuiItemFlags_Disabled)
return false;
...
}
If I get confirmation that there is no reason for disabling hover on disabled items, I will open a PR. If this part would/could get changed I would get exactly what I need out of the SetDisabled functionality already.
P.S. Thank you for ImGUI, it's enabling me to work on a very cool project that probably couldn't have gotten off the ground without this lovely library.
The text was updated successfully, but these errors were encountered:
I agree we should make this possible, but given the nature of the feature I think IsItemHovered() should return false by default because it may trigger various behavior on the user code.
However, we can add a new explicit flag so IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) will bypass the check and that's a trivial change I can make now.
Version/Branch of Dear ImGui:
1.62
My Issue/Question:
I would like to use the _Disabled flag, but would also like to give the user feedback on why an item is disabled. When
ItemHovered()
sees that the item you're checking hasImGuiItemFlags_Disabled
, it always returns false. This makes it harder (workaround is possible of course) to show a tooltip and/or provide more feedback.I understand that the _Disabled flag is WIP functionality which is why I brought it up here first for review instead of opening a pull request.
After a few tests, I didn't spot unintended behavior after removing the check for
_Disabled
fromItemHovered()
, but then I wasn't sure if it should also be removed fromItemHoverable()
for "consistencies' sake". I didn't see any comments/issues discussing this, so I wanted to ask here if anybody knows any good reason to keep the code as is.Standalone, minimal, complete and verifiable example:
The offending(?) code:
If I get confirmation that there is no reason for disabling hover on disabled items, I will open a PR. If this part would/could get changed I would get exactly what I need out of the SetDisabled functionality already.
P.S. Thank you for ImGUI, it's enabling me to work on a very cool project that probably couldn't have gotten off the ground without this lovely library.
The text was updated successfully, but these errors were encountered: