-
-
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
Began improvements to columns API by splitting the Columns() function #913
Conversation
… into BeginColumns() and EndColumns() and adding additional flags. The columns data still needs to be placed into a stack.
From this pull request: ocornut/imgui#913 Preserve column widths when resizing Force column dividers to always stay visible Also adds GetColumnWidth() call
Hey @ggtucker, I merged this into the imgui I'm using for my project and just wanted to say thanks, it's working great. Super useful not having the column dividers get totally lost. Thanks much! |
Hey @mikesart I'm glad these changes were useful to you! Hopefully with enough support they can one day be added to the library in some shape or form as well :) |
Hello, terribly sorry I didn't react on that. My year was a little crazy. It is my intent to go back to imgui and completely redoing/fixing the Columns will be one of the priorities, at which point your PR will probably be useful. Thanks for doing this and posting it! |
…nals.h + minor shallow tweaks. Removed demo code temporarily. (#125)
Steps forward:
Steps backward:
Steps forward:
TL;DR;
Alse note a recent column fix #1266 Thanks @ggtucker, and thanks @mikesart for pushing me to make progress there :) |
PS: Here's a copy of the demo code that @ggtucker added which I have currently removed as the features are not all exposed publicly.
|
Thanks so much @ocornut! It's very exciting to see progress being made towards improving columns, and I'm glad to have helped nudge things forward :). |
…ColumnFlags_*. (#125, #513, #913, #1204, #1444, #2142, #2707) Affected: ImGuiColumnsFlags_None, ImGuiColumnsFlags_NoBorder, ImGuiColumnsFlags_NoResize, ImGuiColumnsFlags_NoPreserveWidths, ImGuiColumnsFlags_NoForceWithinWindow, ImGuiColumnsFlags_GrowParentContentsSize. Added redirection enums. Did not add redirection type.
There are a couple of column behaviors I was seeking to add to my ImGui overlays which were not readily available, so I took it upon myself to prototype some changes to the Columns API that would expose these behaviors in flags. In particular, (1) I wanted a way to preserve column widths similar to how Microsoft Excel does. For example, when moving a column divider to the right, all the following columns should maintain their widths and shift to the right with it when this flag is set. (2) Another behavior I was looking for was to essentially force the column dividers to stay within the confines of the window. This eliminates the possibility of the user shifting a column beyond the width of the window and forgetting it ever existed.
The only other change I made was adding a function call for setting the width of a column.
Feel free to take these changes with a grain of salt, but I'm hoping they can either inspire or be a part of the inevitable Columns API refactor. The reason I named the new columns functions BeginColumns() and EndColumns() is because it follows the structure of other ImGui API calls, and if one day ImGui supports columns nested within other columns, the naming convention is forward compatible for pushing and popping to a stack. Right now if BeginColumns is called twice before EndColumns, there will be an assertion because nesting columns is currently not supported.
I should also note that these changes are entirely backwards compatible. To play around with the new flags, there is also a new "Advanced settings" section in the "Columns" section of the demo window.