-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Checkbox widget replacement with better look #3351
Comments
Hello @mrduda, Thanks for submitting this. (the checkmark shape is a little different, and sorry for blurry upscaled capture) The aim of styling v2 will be to provide finer control per-widget style so this would be easier to alter the look of this while keeping a different look for other widgets. Suggestions of things in your code in your widgets can could improved:
Modelling your code after |
Thank you for feedback! The main reason behind this custom checkbox implementation was the size of original checkbox, which can't be decreased in any known way. The rest (color and border) is just a minor issue. |
You can modify checkbox size by adjusting style ( Line 1044 in ab4ef82
|
Here's another approach, this time I took existing Checkbox() code and modified it only in size, style/color and checkmark parts:
As for ItemInnerSpacing, FramePadding and font size suggestion: have you tried this and it worked, or is it only a guess? I'm not sure it will work as expected because changing font size may result in the incorrect text size calculation for checkbox label. |
You should be using |
As I said before, wrapping ImGui::Checkbox() into Push/PopStyleVar/Color doesn't help to achieve desired checkbox size. The method you have shown (by changing font size and other) does not work. Also, checkmark is custom and the color for checkbox border when mouse is over cannot be changed by Push/Pop calls. Anyway, thanks for attention. |
Version/Branch of Dear ImGui:
Version: 1.78 WIP
Branch: master
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_dx11.cpp
Compiler: MSVC 2019
Operating System: Win10
My Issue/Question:
This is my replacement for built-in checkbox widget. Tri-state is supported. Color is taken from ImGuiCol_Text, with border alpha dimmed down when not hovered.
Screenshots/Video
Standalone, minimal, complete and verifiable example:
The text was updated successfully, but these errors were encountered: