Skip to content

Remove activation by SetNextItemShortcut() causes tooltips to flicker #9138

@achabense

Description

@achabense

Version/Branch of Dear ImGui:

Version 1.92.6 WIP

Back-ends:

imgui_impl_dx9.cpp + imgui_impl_win32.cpp

Compiler, OS:

Windows 10 + MSVC

Full config/build information:

No response

Details:

ImGui::SetNextItemShortcut() will cause tooltip to flicker, no matter whether it's for the item itself or tooltip for other items.

I'm not familiar with shortcut APIs (found this as soon as I tried the function), so maybe I'm missing something?

Image

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

static void test() {
    if (ImGui::Begin("Window")) {
        // Sleep(50);
        // I guess it's related to `ImGuiInputFlags_Tooltip`?
        ImGui::SetNextItemShortcut(ImGuiKey_R/*, ImGuiInputFlags_Tooltip*/);
        ImGui::Button("Button 1");
        // When activated: will be "shifted" for some (one?) frames (but won't disappear).
        if (ImGui::BeginItemTooltip()) {
            ImGui::Text("Press R to activate this button.");
            ImGui::EndTooltip();
        }
        ImGui::Button("Button 2");
        // When activated: will disappear for some (one?) frames.
        if (ImGui::BeginItemTooltip()) {
            ImGui::Text("Press R to activate button 1.");
            ImGui::EndTooltip();
        }
    }
    ImGui::End();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions