mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-14 19:04:44 +00:00
Modal window flickers when shown? #690
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 milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#690
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?
I've implemented a message box dialog on top of imgui, but it seems to flicker a little when the dialog is shown as if it is deciding how to layout the controls in it.
This screenshot was taken just before the window accommodates its contents:
After maybe just one frame, the final window is shown until its closed:
It could be something wrong with my code, but I decided to open an issue just to make sure it's not a known problem.
Hi,
The problem is that TextWrapped() relies on the window width (content width) which is undefined when you first open a window with
ImGuiWindowFlags_AlwaysAutoResize. You can't really have both.The easy solution is to set an explicit width via e.g.
SetNextWindowSize(ImVec2(400,0));prior to the Begin call.To draw the icon you could just use SetCursorPos(), Text(), SetCursorPos(), TextWrapped(). You can also lock the X position with BeginGroup()/EndGroup() but it isn't needed here as you have a single TextWrapped() element.
I was under the impression that it would freeze the window width and resize vertically as items are added but that's not the case (and if it was it would probably have the same problem as the auto resize option). I'd have to specify a height big enough for everyone which isn't really possible nor desirable.
Maybe I'll play with the clipping rectangle to avoid the window being shown for the first frame and let it have a chance to decide on its size. Or maybe not, since imgui is a programmer's UI, It's not likely that people will demand fixes for something like that :)
Thanks!
Woot, I decided to draw the icon using your technique and the flicker is gone!
So I guess all is good now :D
Thanks again!
It's a totally legit question and i'd like to solve it. If width is known then the vertical extent of TextWrapped() will be known on the first pass so there shouldn't be a problem. It's just that auto-width + textwrapped can't work together.
Maybe (400,-1) as size, I don't have the code in front of me but there should be a way to keep auto resize on the vertical axis but not the horizontal one.
Or you can also set explicit text wrapping x position instead of using TextWrapping() that would also work.
Re- on the discussion above
That works:
Without
ImGuiWindowFlags_AlwaysAutoResizeand WITH theImGuiSetCond_Onceparameter.It is important because repeatedly calling SetNextWindowSize() every frame with 0 height and no condition will keep delaying resizing to the next frame (due to a need to calculate height).
It is listed as a thing to improve/fix to allow it working without the
ImGuiSetCond_Onceparameter.That also works:
I have fixed a minor bug now where TextWrapped() would override the wrap position is one was already set. So:
Would have lost the explicit 400 before that fix.