-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Sizing of ComboAutoSelect in table cells #8066
Comments
See Demo->Tables->Item Width. TL;DR; you can use
Define "fit the content" ? Do you mean fit so the combo width would fit exactly the preview text? In this case, it means that changing the combo selection would resize the table, which seems bizarre. It seems to make sense that the contents of previewed label doesn't feed back into ideal width width. (It generally depends how the widgets in question reports its ideal size. Since I don't know what
I cannot reply to unrelated questions in the same thread. They are less searchable for other users. And as proven by this, the more unrelated question you ask the less likely you are going to actually provide enough details to make it possible for us to answer the question. Please refer to the tables demo contents and refer to guidelines when asking questions. |
The problem with table column widths not resizing to fit text is not specific to combo boxes but also to normal text. We have this very unusual case where the content in the table is not determined at the first frame and is not changing 50 times a second. Instead it changes due to user interactions. We therefore have this even more unusual case where the user expects to see all the text in the cell and not have to right click and choose auto-size all columns every time there is a change. Had I not found the function marked "internal" linked to that, I guess I would have done: ImGui:: Text("Please right-click and choose auto-fit columns to see your text") |
Version/Branch of Dear ImGui:
Version 1.90.9, Branch: Docking
Back-ends:
imgui_impl_win32.cpp + imgui_impl_dx11.cpp
Compiler, OS:
Windows 11 + MSVC 2022
Full config/build information:
No response
Details:
I am trying to use ImGui::ComboAutoSelect() element within a table cell. What I want to achieve is that the combo box auto-resizes to fit the preview text and the table column resizes to fit the size of that combo box. I assume this is what ImGuiComboFlags_WidthFitPreview does, at least at the combo level.
Issue 1:
The behaviour I am seeing instead is that the combo sizes proportionally to around 70% of the column width. If I stretch the column width, the combo box width also changes.
The table has ImGuiTableFlags_NoSavedSettings.
I tried setting SetNextItemWidth to -1 before the ComboAutoSelect call. What this did was stretch the combo infinitely. If I set next item width to constant, the combo doesn't auto-stretch to fit the preview.
Issue 2:
In no case does the table column auto-resize to fit the content. I guess this is not default behaviour, but is there a flag or a call I can use to have it mimick the "Size All Columns To Fit" menu option?
Issue 3:
How do I remove ALL padding from the table cell so that the combo rectangle sits tightly along the table grid lines. I tried setting ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 0,0 }) but that didn't work.
Thanks.
The text was updated successfully, but these errors were encountered: