Skip to content
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: set minimum width for stretch column #5685

Open
dcnieho opened this issue Sep 15, 2022 · 5 comments
Open

Table: set minimum width for stretch column #5685

dcnieho opened this issue Sep 15, 2022 · 5 comments

Comments

@dcnieho
Copy link

dcnieho commented Sep 15, 2022

Version/Branch of Dear ImGui:
Version: 1.82
Branch: master, https://github.com/ocornut/imgui/tree/35b1148efb839381b84de9290d9caf0b66ad7d03

Back-end/Renderer/Compiler/OS

Back-ends: glfw
Compiler: unsure, using pyimgui wrapper, dev/2.0 version (https://github.com/pyimgui/pyimgui/tree/dev/version-2.0)
Operating System: Windows 10, 10.0.19044

My Issue/Question:

In a child window with vertical and horizontal scroll, I'm using a table to layout a list of items. I have a few fixed width columns, then a column that should be as wide as possible, and then some more fixed width columns (from 1 to many). The problem is that if there are many fixed width columns after my stretch column, the stretch column becomes very narrow and its contents thus invisible. Is it possible to set a minimum width for a column so that it cannot become too tiny, while simultaneously have it stretch to take up all the available space in the child not taken by the other columns?
I noticed this seems to be on the todo list, but perhaps there is a workaround for this case?

Screenshots/Video

With not many columns it looks good (nicely filled-out interface):
image

With many columns, the name column becomes practically invisible because its so narrow. I would like it to have a minimum width:
image

@ocornut
Copy link
Owner

ocornut commented Sep 27, 2022

Hello,
I presently cannot think of a workaround for this.

@ocornut
Copy link
Owner

ocornut commented Sep 27, 2022

I have looked and I don't think I can reliably implement this quickly. There are subtle and conflicting constraints involved to get this right with multiple stretched columns, resizable and reorderable columns, it doesn't seem like a simple problem to solve (may take me up to a day to reliably test and implement).

@dcnieho
Copy link
Author

dcnieho commented Sep 29, 2022

@ocornut: Thanks for having a look Omar! I'm afraid i don't have funds to help you prioritize this. Since it is already on your todo list, feel free to close this issue if you think that its not needed.

Thanks again for all your great work! I'm really loving working with imgui, it not only works well, but also appears as really well thought out!

@ocornut
Copy link
Owner

ocornut commented Sep 29, 2022

I’ll keep this open. Honestly it is a bit frustrating that it isn’t more simple but I may get around to do it eventually. Another slight problem if we don’t have the API entry point to specify that value and TableSetupColumn() already takes a weight, so there’s a bit of design required.

@ghost
Copy link

ghost commented Aug 2, 2023

I have a similar usecase, and was wondering as a possible solution if it might be possible to define a column as:

ImGui::TableSetupColumn("ExampleColumn", ImGuiTableColumnFlags_WidthMinStretch, 200.0f);

My thought is that it'd then allow ImGui to compute essentially columnWidth = max(width, remainingWindowWidth) (or if multiple columns are WidthStretch/WidthMinStretch the max of the set width or the 'fair share' of widths. Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants