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

Transparency of Modal Windows #470

Closed
nikmes opened this issue Jan 4, 2016 · 7 comments
Closed

Transparency of Modal Windows #470

nikmes opened this issue Jan 4, 2016 · 7 comments

Comments

@nikmes
Copy link

nikmes commented Jan 4, 2016

Is there a way to control transparency of a modal window? Looks like below dose not allow to pass ALPHA value as an argument.
if (ImGui::BeginPopupModal("File Operations", NULL, ImGuiWindowFlags_HorizontalScrollbar))
I tried to play with below:
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.f);
But didnt get desired results. Instead i got Modal window on a GREY background.
Thanks!

@nikmes
Copy link
Author

nikmes commented Jan 4, 2016

image

I don't want the Warning Window to have transparency at all.

@ocornut
Copy link
Owner

ocornut commented Jan 4, 2016

There is an inconsistency discussed in #337, you could alter the "style.WindowFillAlphaDefault" field and set it to 1.0.

This field may be removed and instead the value flattened across the different WindowBg colors.

@nikmes
Copy link
Author

nikmes commented Jan 4, 2016

Thanks! It works but i need to restore back the global Alpha Default otherwise all windows in rendering loop get this value. Thanks for you support!

I do something like this
prevAlpha = ImGui::GetStyle().WindowFillAlphaDefault;
ImGui::GetStyle().WindowFillAlphaDefault = 1.0;
.....
ImGui::GetStyle().WindowFillAlphaDefault = prevAlpha;

@ocornut
Copy link
Owner

ocornut commented Jan 4, 2016

Yes this should be the correct workaround. I am hesitating to add an enum for PushStyleVar() because this value should be removed eventually. See the update I just made to #337.

@nikmes
Copy link
Author

nikmes commented Jan 5, 2016

Hi i checked the update. Wouldn't be easier just to allow the ImGui::BeginPopupModal to accept arguments like the ImGui::Begin("Grid Properties", opened, ImVec2(0, 0), 0.90f, ImGuiWindowFlags_NoScrollbar) ?

@ocornut
Copy link
Owner

ocornut commented Jan 5, 2016

No because that 'alpha' parameter is part of an obsolete Begin() entry point and is very rarely used. For a rarely used parameter it would make more sense to have a PushStyleVar(WindowFillAlpha, 1.0f) thing rather than bloating entry points.

@ocornut
Copy link
Owner

ocornut commented Aug 17, 2018

@nikmes Btw I realized this issue has been fixed a while ago (1.60) with the addition of SetNextWindowBgAlpha(). Closing this issue accordingly.

@ocornut ocornut closed this as completed Aug 17, 2018
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