Highlight item or window(main, child)

#1

Version/Branch of Dear ImGui:
Version: 1.69
Branch: docking

Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_opengl2.cpp + imgui_impl_glfw.cpp
Compiler: Visual Studio 2017
Operating System: Win10

My Issue/Question:
hello.

Is there a function that highlights item or window according to active or hovered state?
( like Metrics example.
imgui.cpp -> 13945 line(fg_draw_list->AddRect(window->Pos… )

Referring to the Metrics example, i tried to test the following
but there is problem

...
static void                     highlight_test( const ImVec2 size )
{
    if( ImGui::IsWindowFocused() )
    {
        ImVec2 sp = ImGui::GetCursorScreenPos();
        ImGui::GetForegroundDrawList()->AddRect( ImVec2( sp.x, sp.y ), ImVec2( sp.x  + size.x, sp.y + size.y ), IM_COL32( 255, 255, 0, 255 ) );
    }
}

result)

question 1)
AddRect thickness is 1px(default) but bottom line is saturation 2px line. why…?

question 2)
i know that the selectable and drag and drop functions show similar features.
but it is utilization is limited. Is there no need for a universally available highlight function?
(for window, viewport, item)

Thank you always.

0 Likes

#2

for me no, you not have a generic highlight function. the highlight is done in each widgets. color change according to hovered state.

by example in ImGui::ButtonEx you have taht :slight_smile:

 const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
0 Likes