mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-14 19:04:44 +00:00
Issue with changing menu height #3516
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#3516
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?
Version/Branch of Dear ImGui:
Version: 1.79
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp
Compiler: VS 2019
Operating System: Windows 10 (2004)
My Issue/Question:
I am styling my app right now and in the process I want to change the height of the main menu bar. In order to change the menu height I adjust the frame padding. The problem is that during hovering and activation the padding size is not taking into consideration. This seems inconsistent with other UI systems. Is there a way how I can have the menubar entries fill out the entire menu bar during hovering/selection?
BTW: In this context - I find it counter intuitive that hovering supersedes activation. If an item is hovered and active the hovered color is chosen. I find myself often fiddling unnecessarily with style variables to work around this.
Screenshots/Video
Standalone, minimal, complete and verifiable example:
This can be very easily reproduced in the demo:
I found a workaround for this. You can push the item spacing to counter the tight packing of the selectable before drawing each menu.
I found a workaround for this. You can push the item spacing to counter the tight packing of the selectable before drawing each menu.
I found a workaround for this. You can push the item spacing to counter the tight packing of the selectable before drawing each menu.
About this specific comment (which is a different issue than the main one):
This seems to a bug caused by specific interaction behavior required by menu items (including not but limited to: allowing navigating menu while holding mouse down and releasing mouse on any child menu).
MenuItem(): we useImGuiButtonFlags_PressedOnReleasebehavior, which is standard and required, but I think ButtonBehavior() incorrect doesn't report theheldstate as this is gated by active id being taken. I think this is a bug inButtonBehavior()and can be fixed but I need to investigate the possible side-effects.BeginMenu(): this is slightly different and trickier, as clicking opens a sub-menu and takes focus away.For correctness we should fix both together (fixing only one would look widely inconsistent).
About this specific comment (which is a different issue than the main one):
This seems to a bug caused by specific interaction behavior required by menu items (including not but limited to: allowing navigating menu while holding mouse down and releasing mouse on any child menu).
MenuItem(): we useImGuiButtonFlags_PressedOnReleasebehavior, which is standard and required, but I think ButtonBehavior() incorrect doesn't report theheldstate as this is gated by active id being taken. I think this is a bug inButtonBehavior()and can be fixed but I need to investigate the possible side-effects.BeginMenu(): this is slightly different and trickier, as clicking opens a sub-menu and takes focus away.For correctness we should fix both together (fixing only one would look widely inconsistent).
About this specific comment (which is a different issue than the main one):
This seems to a bug caused by specific interaction behavior required by menu items (including not but limited to: allowing navigating menu while holding mouse down and releasing mouse on any child menu).
MenuItem(): we useImGuiButtonFlags_PressedOnReleasebehavior, which is standard and required, but I think ButtonBehavior() incorrect doesn't report theheldstate as this is gated by active id being taken. I think this is a bug inButtonBehavior()and can be fixed but I need to investigate the possible side-effects.BeginMenu(): this is slightly different and trickier, as clicking opens a sub-menu and takes focus away.For correctness we should fix both together (fixing only one would look widely inconsistent).
Following this small shuffling
83429abIt is possible to fix this "bug" with this additional patch:
imgui-05d8995-ButtonBehavior() fix not reporting held state when using ImGuiButtonFlags_NoHoldingActiveId or ImGuiButtonFlags_PressedOnRelease which are used by MenuItem() and BeginMenu().patch
However this makes the navigating-menu-while-holding-mouse-button way of interacting menus look a little odd IHMO.
While comparing with others app (tried Firefox, VS2022, Win11 Explorer, SublimeText) I noticed that none of them use an 'Active' color for menu items, maybe for this exact reason.
In theory even we decided to not change it, it may be correct to apply patch then have MenuItem/BeginMenu intentionally override colors to counteract the fix, but that would prevent your workaround at well as making a rather side-effectey change to
ButtonBehavior()for no visible reason, so may not be a good trade-off.Following this small shuffling
83429abIt is possible to fix this "bug" with this additional patch:
imgui-05d8995-ButtonBehavior() fix not reporting held state when using ImGuiButtonFlags_NoHoldingActiveId or ImGuiButtonFlags_PressedOnRelease which are used by MenuItem() and BeginMenu().patch
However this makes the navigating-menu-while-holding-mouse-button way of interacting menus look a little odd IHMO.
While comparing with others app (tried Firefox, VS2022, Win11 Explorer, SublimeText) I noticed that none of them use an 'Active' color for menu items, maybe for this exact reason.
In theory even we decided to not change it, it may be correct to apply patch then have MenuItem/BeginMenu intentionally override colors to counteract the fix, but that would prevent your workaround at well as making a rather side-effectey change to
ButtonBehavior()for no visible reason, so may not be a good trade-off.Following this small shuffling
83429abIt is possible to fix this "bug" with this additional patch:
imgui-05d8995-ButtonBehavior() fix not reporting held state when using ImGuiButtonFlags_NoHoldingActiveId or ImGuiButtonFlags_PressedOnRelease which are used by MenuItem() and BeginMenu().patch
However this makes the navigating-menu-while-holding-mouse-button way of interacting menus look a little odd IHMO.
While comparing with others app (tried Firefox, VS2022, Win11 Explorer, SublimeText) I noticed that none of them use an 'Active' color for menu items, maybe for this exact reason.
In theory even we decided to not change it, it may be correct to apply patch then have MenuItem/BeginMenu intentionally override colors to counteract the fix, but that would prevent your workaround at well as making a rather side-effectey change to
ButtonBehavior()for no visible reason, so may not be a good trade-off.Linking to #6134 for related issue.
I was toying with something related today:
And noticed both the issue with menu highlight height, and potentially with wanting to add a bit of padding at the top of the tab-bar.

I'll try to come to back to this.
Linking to #6134 for related issue.
I was toying with something related today:
And noticed both the issue with menu highlight height, and potentially with wanting to add a bit of padding at the top of the tab-bar.

I'll try to come to back to this.
Having TabTopPadding would help dock tabs a lot too. Currently things get very busy (depends on color scheme too, though).