Sorry to keep bothering...
Version/Branch of Dear ImGui:
latest release
Back-end/Renderer/OS: _(if the question is related to inputs or rendering, otherwise delete this section)_
mac opengl 3.3
My Issue/Question:
When I create a window with columns and flags:
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings
it animates to the width of my application. Then, as soon as I drag it to the right so the right border of the window hits the right border of my application, it animates to be what seems to be a minimum width. I can drag it left all I want and then move it around as long as the right edge doesn't touch and it won't shrink. After it shrinks, if I drag it back to the left, it will grow back to full width.
This worked with imgui code from a while ago. It would just make a window of a nice reasonable width and it would stay that way.
(you may want to mute, my trackpad clicks are kind of loud)
https://www.youtube.com/watch?v=xSv6hdCBrj8
I removed code until I got to the point it was just calling my columns helper code:
void Gui::
columns(const char * column_region_id, std::vector<std::string> const & column_names, std::function<void(void)> column_builder)
{
NO_OP_IF_NO_GRAPHICS;
ImGui::Columns(static_cast<int>(column_names.size()), column_region_id);
ImGui::Separator();
for (auto column_name : column_names) {
ImGui::TextUnformatted(column_name.c_str());
ImGui::NextColumn();
}
ImGui::Separator();
try {
column_builder();
} catch (...) {
ImGui::Columns(1);
ImGui::Separator();
throw;
}
ImGui::Columns(1);
ImGui::Separator();
}
also, the animation speed is faster if I am dragging the window vs if the window is stationary during the animation.. this is for both it growing and shrinking.
There was a bug in old versions where only last column would declare its width to the container, it was sort of a convenient bug but it didn't make much sense.
Columns are containers that uses the space they have available, they don't declare their space outside for now. The easiest solution is either to decide how much width you want for the window (via SetNextWindowSize or SetCursorPos) or stop using ImGuiWindowFlags_AlwaysAutoResize.
As to why your window actually grows I have no idea, it would need a precise and complete repro. Right now I don't have your code neither any of your data or context.
I whittled it down to this -- and removing the NoSavedSettings flag makes the problem go away. The column count must be set to at least 2 for this to occur as well.
bool show=true;
if(ImGui::Begin("m", &show, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings)) {
ImGui::Columns(2, "a");
ImGui::Columns(1);
}
ImGui::End();
And like I said, I'm on the actual 1.60 release code, not latest checkin.
Thanks, this is a great repro. OK the issue seems more severe than I thought it was, will look into it shortly.
if (ImGui::Begin("Bug #1760", NULL, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings))
{
ImGui::Columns(2);
ImGui::Text("Blah");
ImGui::NextColumn();
ImGui::Text("Blah");
ImGui::Columns(1);
}
ImGui::End();
There are two distinct issues here:
NoSavedSettings disabled the default window position (so it would be e.g. 0,0 instead of 60,60). I see no reason to make this distinction, it was a mistake and I fixed it now.
Columns have a bug I somehow introduced in 1c83b073c66341ea7b22d7dd42916094c9a0fdeb (#519, #125, #913), but at the time the bug was hidden by the fact that MaxX wasn't the same at it is today.
// Columns don't grow parent
window->DC.CursorMaxPos.x = ImMax(window->DC.ColumnsStartMaxPosX, window->DC.ColumnsMaxX);
Should be
window->DC.CursorMaxPos.x = window->DC.ColumnsStartMaxPosX;
There's two bugs here: there's no reason to do that ImMax() call here, and ColumnsMaxX is a relative offset, it should have been window->Pos.x + MaxX - this is the reason the resize glitched differently depending on the window position, and the reason why the initial position affected by ImGuiWindowFlags_NoSavedSettings has an effect on that. Note that the bug only affected auto-resizing which is less frequently used with columns.
Both issues should be fixed now.
Note that with the fixes, if you use AlwaysAutoResize, your columns should fit within whichever maximum space was requested by the rest of the window. So e.g. in this shot probably to the right of the "Message Frequency" text. TL;DR; at the moment Columns are not really meant to be used with auto-resizing windows.

thanks for the quick turnaround! I confirmed that solved my issue. I agree that the combination of flags I'm using isn't the best for my use case. Sometimes you need clueless users to find weird bugs you'd never think to test for because they don't make any sense :)