Imgui: how can i make buttons greyed out and unclickable in imgui? is there any flag or built in function for that ?

Created on 19 Jun 2018  路  1Comment  路  Source: ocornut/imgui

You may use the Issue Tracker to ask for help and submit bug reports, feature requests or suggestions.

PLEASE CAREFULLY READ THIS DOCUMENT before doing so:
CONTRIBUTING.md.

SELECT "PREVIEW CHANGES" TO TURN THE URL ABOVE INTO A CLICKABLE LINK.

(Delete everything above this section before submitting your issue. Please read the CONTRIBUTING.md file!)


Version/Branch of Dear ImGui:

XXX

Back-end file/Renderer/OS: _(if the question is related to inputs/rendering/build, otherwise delete this section)_

XXX

My Issue/Question: _(please provide context)_

Standalone, minimal, complete and verifiable example: _(see CONTRIBUTING.md)_

ImGui::Begin("Example Bug");
MoreCodeToExplainMyIssue();
ImGui::End();

Screenshots/Video _(you can drag files here)_

Most helpful comment

See #211 (mostly the lower posts).

There is a function ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); in the imgui_internal.h (non-public) API which you may use. It's however not finished and doesn't affect visuals at all, so the widgets won't become grey.

Currently you may do something like that:

    static bool disabled = false;
    ImGui::Checkbox("Disable", &disabled);
    if (disabled)
    {
        ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
        ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
    }
    [...]
    if (disabled)
    {
        ImGui::PopItemFlag();
        ImGui::PopStyleVar();
    }

PS: Next time you post something please fill in the issue as requested by the issue template.

>All comments

See #211 (mostly the lower posts).

There is a function ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); in the imgui_internal.h (non-public) API which you may use. It's however not finished and doesn't affect visuals at all, so the widgets won't become grey.

Currently you may do something like that:

    static bool disabled = false;
    ImGui::Checkbox("Disable", &disabled);
    if (disabled)
    {
        ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
        ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
    }
    [...]
    if (disabled)
    {
        ImGui::PopItemFlag();
        ImGui::PopStyleVar();
    }

PS: Next time you post something please fill in the issue as requested by the issue template.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bizehao picture bizehao  路  3Comments

ocornut picture ocornut  路  3Comments

BlackWatersInc picture BlackWatersInc  路  3Comments

bogdaNNNN1 picture bogdaNNNN1  路  3Comments

noche-x picture noche-x  路  3Comments