-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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
getting tightest possible horizontal spacing #7601
Comments
If by labels you mean LabelText() its a widget that follows the current value of ItemWidth to match the width of a Slider or any other framed widget. You can control that width with PushItemWidth() or SetNextItemWidth() and there’s a section in Demo>Layout detailing it. It defaults to something like 2/3 of the window and its a bit awkward because it doesn’t lend itself to manual resizing (i have some ideas in mind to improve it). There’s not calculation of either side contents in that situation. However, it seems like you should be using a table and set column policy to fit/stretch or make the table resizable. |
To clarify if you were submitting eg Drags or Sliders or Inputs you would see the frame on the left and this frame’s width is derived from ItemWidth, and it would make a little bit more sense as to why the left side is not best-fit. (It’s a recurrent question/wonder in the sense that both the order and lack of manual resizing is not ideal. What people do nowadays if they want the best-fit is to use a two columns table, add label in one column and widgets without label filling the other column (using -FLT_MIN you right align frames to available bounds). it’s probably good to browse the Examples in Demo for some references. |
my GUI is constructed dynamically, so it's awkward to know if you're in a run of labels that could share a table or not. I could do Text--SameLine--Text but what would really make it sing is some way of tabstopping. If the first Text was < some width, then pass an offset to SameLine. CalcItemWidth isn't what I need according to the docs. I've been digging in the excellent manual demo https://pthom.github.io/imgui_manual_online/manual/imgui_manual.html but not found anything yet. |
I believe every fields should share the same table, why wouldn’t they? |
I've got collapsing headers and tree nodes all mixed up in there, it's callbacks all over the place. I think I figured out a way to table runs of labels tho, will give that a go. |
You can call EndTable() when using a collapsing header and reopen it immediately, that’s also a solution. |
Version/Branch of Dear ImGui:
1.90.1
Back-ends:
Psydack's UImGui port v4.1.0
Compiler, OS:
Windows 10, Unity 2023.2.13
Full config/build information:
No response
Details:
I've got a collection of mostly Labels under Collapsible Headers. Something about my layout means I have to have much wider windows than seem necessary.
In the first screenshot below, this is the narrowest I can have this window and still read everything in the right-hand column. If I go narrower, as in the second screenshot, the right-hand column starts to get cut off. This is despite there still being plenty of space in the middle to eat up.
Am I missing an option to let Dear ImGui prioritise shrinking empty space before it cuts off content?
Screenshots/Video:
Minimal, Complete and Verifiable Example code:
No response
The text was updated successfully, but these errors were encountered: