-
-
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
ImGui::Separator() ignores grouping #205
Comments
Hmm- The problem is that even though I can fix it for the left side, at the point where you are calling Separator the group is still growing and doesn't have a known width. So the fix will not cover every case evenly. Perhaps later on BeginGroup() can take size and function as a small subset of BeginChild to cover this sort of thing. |
Yeah, or add size parameter to separator itself. |
I have committed the above because I think it is more correct, it should fix your use case. However I need to add new parameters and variants to Separator() to cover more cases. We have a similar open issue with Columns(), and there is also the fact the Separator() by default draw but do not "register" its size back into the layout. This is desirable by default, but If a size is explicitly passed it should probably register it. I'll keep this bug open until I can come up with answers to those various problems. |
OK, also there are similar issues with other widgets, for example: //ImGui::Text("Status: %s", sites[current_site].title_statuses[current_title_it->second.status].c_str());
ImGui::Text("Status: ");
ImGui::SameLine();
ImGui::Combo("", (int *)¤t_title_it->second.status, &sites[current_site].title_statuses[0], sites[current_site].title_statuses.size()); |
What is the issue here? Btw for this sort of situation you can call ImGui::AlignFirstTextHeightToWidgets() prior to Text to vertically align the Status text downward. Later on you'll be able to use Label-Widget configuration instead of Widget-Label so it will be made easier. |
Yes, thank you, ImGui::AlignFirstTextHeightToWidgets() helped with vertical alignment (what's interesting is that I didn't noticed that issue before). // Default item width. Make it proportional to window size if window manually resizes
if (window->Size.x > 0.0f && !(window->Flags & ImGuiWindowFlags_Tooltip) && !(window->Flags & ImGuiWindowFlags_AlwaysAutoResize))
window->ItemWidthDefault = (float)(int)(window->Size.x * 0.65f);
else
window->ItemWidthDefault = 200.0f; and adding window->ItemWidthDefault = -1; instead in ImGui::Begin, so now ImGui::CalcItemWidth() returns valid value and we can see combobox'es down arrow inside the window: |
it's not a bug here. The default behaviour for big widget is to take 65% of the width. |
Yeah, but why not 55% or 70%? ;-) I mean, why not auto-size items by it's content, 'cos right now I write something like this: const char *num_str = 0;
Items_IndexNumberArrayGetter(0, num, &num_str);
ImGui::PushItemWidth(ImGui::CalcTextSize(num_str).x + ImGui::GetStyle().ItemInnerSpacing.x + ImGui::GetStyle().FramePadding.x + ImGui::GetWindowFontSize() + ImGui::GetStyle().FramePadding.x * 2.0f);
ImGui::Combo("##num", &num, Items_IndexNumberArrayGetter, 0, some_num));
ImGui::PopItemWidth(); |
The default behavior is that we want all widgets to be aligned with each other so we have the same width, and ImGui at the moment by default uses a "widget -- label" scheme which was chosen to minimize the need for clipping rectangles. I am not sure to understand what you are trying to do. If you wanted the combo box to be the size or your "Watched" string then it would change size every time you select another value (e.g. "Want to Watch"), which would look odd and possibly mess up with layout. I've never seen a combo box behave like that with a standard widget system. It's possible as you are showing but not sure why you are doing that. If you want to achieve what's in the picture above, aka align the combo to the right size of the window, then you can do
This will later be made easier as a I refactor the widget "layouts" options to allow for multiple settings including "label (single space) widget". |
Closing this issue as mostly sanitized/standardized now. |
You're truly a hero for still remembering & working on an issue nearly a decade ago. I do freelancing and i use imgui for most of my GUI, i love to donate for your work but i unfortunately can't aford it because i live in a poor country and even 5 American Dollar can feed my family for 5 days. All i can do is wish you do well, have lots of health and be successful on your carreer. Omar - not the hero we deserve, but the hero we need! |
You can see on the attached
screenshot that separator intersects image on the left, code to reproduce:
The text was updated successfully, but these errors were encountered: