Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadOnly ItemFlag is partially working with ColorEdit #7079

Closed
sneakyevil opened this issue Nov 30, 2023 · 3 comments
Closed

ReadOnly ItemFlag is partially working with ColorEdit #7079

sneakyevil opened this issue Nov 30, 2023 · 3 comments

Comments

@sneakyevil
Copy link
Contributor

As the title says.

Code example:

ImGui::PushItemFlag(ImGuiItemFlags_ReadOnly, true);

ImGui::ColorEdit4("Color", g_Colour); // Still can be edited in some places.

ImGui::PopItemFlag();

I wanted to use ColorEdit as color preview for one of my tool and prevent user to edit it, but doing pushing item flag readonly for coloredit will prevent only the dragfloat inputs, but they still can be edited by double clicking on it and changing the values.
This same behaviour exist when clicking the colorbutton that popups the modal for color editing. This isn't really much issue for me, but couldn't find anyone mention it and might someone use it in future and would be good to have it working.

Here is preview of the issue:

2023-11-30.19-48-22.mp4
@ocornut
Copy link
Owner

ocornut commented Nov 30, 2023

ReadOnly is curfently very partially supported by a few widgets. Note there is a public Disabled flag, used via BeginDisabled()/EndDisabled() which might solve your needs?

@sneakyevil
Copy link
Contributor Author

I know it is partially supported, just wanted to make issue so it is noted somewhere. Also I don't want to fully disable the widget. I want user to be still able to copy all the colors like RGBA and other formats that can be shown in that modal popup. My only option right now is to make custom widget for that. If the readonly worked as it should I wouldn't need to.

ocornut added a commit that referenced this issue Dec 1, 2023
@ocornut
Copy link
Owner

ocornut commented Dec 1, 2023

I pushed 5768de7 adding better support for ImGuiItemFlags_ReadOnly in InputText() and ColorEdit4(), ColorPicker4().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants