mirror of
https://github.com/ocornut/imgui.git
synced 2026-10-20 19:08:56 +00:00
Child Window using ImGuiWindowFlags_AlwaysAutoResize #1395
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#1395
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Is it possible to have a child windows obey the ImGuiWindowFlags_AlwaysAutoResize flag?
It currently doesn't but I am not sure if there are other child window constraints that make this flag impossible to support or if it's an error.
Thanks!
Ok I have seen where it's overriding the size
And now I understand that to achieve what I want, additionally to modifying the above code I need separate AlwaysAutoResizeX and AlwaysAutoResizeY.
@Pagghiu I'm interested to understand what you are trying to achieve there? If you auto-resize a child window it would essentially prevent scrolling from happening, which maybe cancel out the point of a child window?
About the code you posted: you should update to master before trying to make changes to it because I have recently applied some renaming/refactoring to this, there's no
size_on_first_useanymore,BeginChild()just callsSetNextWindowSize()prior toBegin().Sorry for the delay in the response, so many things going on this week! 😄
I am creating our own thin (or maybe not so thin) wrapper on top of ImGui, mainly to shield our UI systems from any API breakage that future versions of the library may introduce and some other reasons.
While doing that I've decided to experiment and add some kind of styling and animation support, to do transitions, along the lines of modern mobile OS (android/ios).
I am trying to wrap the Push/Pop system with a "style" object that can push multiple things all at once and that one can always override when calling a single control function, with the overall goal of reducing code verbosity when changing styles often.
The (currently incomplete) experimental api looks like this.
What I am trying to achieve is using child windows in the "HeaderBackground" functions mainly for
Unless I am missing something here, even with latest code from master there's no way to have a children "autosize" itself, that is what I need here to avoid hardcoding the headerBackground "child window" size in the associated function call.
Below you can find the running example that I've recorded from the above code:
Hi,
Nice looking stuff :)
I haven't looked very much in details yet, but it looks like you could achieve most of the same thing will only using ImGui::PushClipRect(), animating the height of your clipping rectangle, and after submitting your contents measuring the distance so you can stop growing at that point. You are presumably already storing animation state for that growing height, you'd only need to store two values (height and max height).
Unrelated but in recent commit I added internal values to measure time since Hovering or Activating an item. I wanted it for some effect related to docking, but that data could also be used for animation effects