Funny tooltip behavior if using BeginGroup/EndGroup #849

Closed
opened 2016-09-27 06:26:06 +00:00 by usagi · 2 comments
usagi commented 2016-09-27 06:26:06 +00:00 (Migrated from github.com)

Code

    ImGui::BeginGroup();
    ImGui::SmallButton( "button" );
    if ( ImGui::IsItemHovered() )
      ImGui::SetTooltip( "BUTTON" );
    ImGui::EndGroup();
    if ( ImGui::IsItemHovered() )
      ImGui::SetTooltip( "GROUP" );

Behavior

  1. We can see the "GROUP" tooltip if hovered.
  2. But, we will see the "BUTTON" tooltip if pressing the button. ( I think it is a funny behavior. )

I think, the correct behavior is show the "GROUP" tooltip in every time. Or, the "BUTTON" in every time.

# Code ``` c++ ImGui::BeginGroup(); ImGui::SmallButton( "button" ); if ( ImGui::IsItemHovered() ) ImGui::SetTooltip( "BUTTON" ); ImGui::EndGroup(); if ( ImGui::IsItemHovered() ) ImGui::SetTooltip( "GROUP" ); ``` # Behavior 1. We can see the "GROUP" tooltip if hovered. 2. But, we will see the "BUTTON" tooltip if pressing the `button`. ( I think it is a funny behavior. ) I think, the correct behavior is show the "GROUP" tooltip in every time. Or, the "BUTTON" in every time.
ocornut commented 2016-09-28 05:12:20 +00:00 (Migrated from github.com)

Thanks, I will look at it.

Thanks, I will look at it.
ocornut commented 2016-10-01 12:11:56 +00:00 (Migrated from github.com)

Should be fixed now. IsItemHovered() will return true for both the button and the group.

(Note that the behavior of SetTooltip() is to overwrite a previous tooltip, whereas BeginTooltip()/EndTooltip() does a regular append.)

ImGui::Begin("Bug #849");
ImGui::BeginGroup();
ImGui::SmallButton( "button" );
if ( ImGui::IsItemHovered() )
    ImGui::SetTooltip( "BUTTON" );
ImGui::EndGroup();
if ( ImGui::IsItemHovered() )
    ImGui::SetTooltip( "GROUP" );
ImGui::End();
Should be fixed now. IsItemHovered() will return true for both the button and the group. (Note that the behavior of SetTooltip() is to overwrite a previous tooltip, whereas BeginTooltip()/EndTooltip() does a regular append.) ``` ImGui::Begin("Bug #849"); ImGui::BeginGroup(); ImGui::SmallButton( "button" ); if ( ImGui::IsItemHovered() ) ImGui::SetTooltip( "BUTTON" ); ImGui::EndGroup(); if ( ImGui::IsItemHovered() ) ImGui::SetTooltip( "GROUP" ); ImGui::End(); ```
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#849
No description provided.