Closed TomieAi closed 1 year ago
nvm i think i found it
See "Demo>Layout&Scrolling->Widgets Width" to understand this.
A regular window has default ItemWidth (for framed widgets) of about 65% of the window width.
You can change it with PushItemWidth()
and SetNextItemWidth()
A widget with ImGuiWindowFlags_AlwaysAutoResize
CANNOT have a default ItemWidth propotional to window width, because window width is derived from item widths... So when ImGuiWindowFlags_AlwaysAutoResize
is set the default ItemWidth is based on font size.
Code in Begin()
;
// Default item width. Make it proportional to window size if window manually resizes
if (window->Size.x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize))
window->ItemWidthDefault = ImFloor(window->Size.x * 0.65f);
else
window->ItemWidthDefault = ImFloor(g.FontSize * 16.0f);
Version/Branch of Dear ImGui:
Version: 1.89.5 WIP Branch: master
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_dx12.cpp+ imgui_impl_win32.cpp Compiler: MSVC x64 (2022) Operating System: Win11
My Issue/Question:
What's with the weird padding on the right? ImGuiWindowFlags_AlwaysAutoResize is doing it perfectly perfect padding on left and right.. without it .. its weird xD its not balance even if u make the window small it retain its extra padding on the right. large padding
how can i achieve what ImGuiWindowFlags_AlwaysAutoResize does without using it xD i just like the perfect padding but still resizable
Screenshots
without ImGuiWindowFlags_AlwaysAutoResize
with ImGuiWindowFlags_AlwaysAutoResize