-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Table Not Automatically Adjusting Column width to contained controls. #7771
Comments
The default value for ItemWidth for each column is about two-third of a column. In general SetNextItemWidth(-FLT_MIN); makes the frames items align to the right edge of available space, but in this case it won’t work: you cannot simultaneously request columns to measure the width of their contents and request contents to match the columns width. You probably need to either give a size to your columns, or use SetNextItemWidth() to size your input fields. PS: you can surround your row with PushID(i)/PopID() and them you won’t have to include i as part of each of your field names, they can become simpler literals. |
I want the Input to size to the content and the column to size to the Max Input size. For example, if I have an |
The widest double value is probably DBL_MAX and may not be what you want to use as a width reference. Why not use SetNextItemWidth() with a reasonable amount eg CalcTextSize(“999.99”).x ? |
Perfect! Thank you! |
Version/Branch of Dear ImGui:
Version 1.90.1, Branch: docking
Back-ends:
imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp
Compiler, OS:
Windows 11 MSVC 2022
Full config/build information:
Dear Imgui -> Dear Bindings -> Odin Imgui
dear_bindings: https://github.com/dearimgui/dear_bindings
Odin Imgui: https://gitlab.com/L-4/odin-imgui
Details:
My Issue/Question:
I am trying to create a table where the columns automatically adjust their width to fit the contents and creates a horizontal scroll bar when it is larger than the window. Right now, the columns are being sized to just the headers, and not to the controls in the rows. You can see in the
Name
column that theInputText
is being cut off.I'm also finding that the
InputDouble
columns are reserving space to the right of the control instead of filling the entire columnScreenshots/Video:
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: