Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

measure menu bar height #252

Closed
extrawurst opened this issue Jun 29, 2015 · 4 comments
Closed

measure menu bar height #252

extrawurst opened this issue Jun 29, 2015 · 4 comments
Labels
menus menu bars, menu items

Comments

@extrawurst
Copy link
Contributor

I want to place a window right below the main menu bar. is there a way to query that height reliably?

@ocornut
Copy link
Owner

ocornut commented Jun 29, 2015

You should be able to call GetWindowSize() from within BeginMainMenuBar() / EndMainMenuBar().

extrawurst pushed a commit to extrawurst/unecht that referenced this issue Jun 29, 2015
@extrawurst
Copy link
Contributor Author

awesome, thanks!

extrawurst pushed a commit to extrawurst/unecht that referenced this issue Oct 24, 2015
* feature/issue85_assetsystem: (30 commits)
  Update .travis.yml
  Update .travis.yml
  Update .travis.yml
  Update .travis.yml
  clean remove newly unused submodule
  fix correct main menu height calculation (see ocornut/imgui#252)
  update win32 cimgui binary and submodule dep
  update to current cimgui
  can close asset view with "X"
  - fix sorting of console messages - todo for issue #133
  switch to new logging
  issue ref
  do not ignore dub.selection anymore
  fix module/file name
  fix texture loading of an asset texture (#85)
  play/pause/step buttons in menubar (closes #129)
  fix compilation of non-editor version
  closes #126: menu components in separat module
  cleanup
  todo added
  ...
@ocornut
Copy link
Owner

ocornut commented Apr 18, 2018

Linking to #1439 for search purposes, note that if you increase style.DisplaySafeAreaPadding (generally for TV set) the main menu bar may become taller. So using GetWindowSize() as noted here is the correct-er solution for measuring the size of a menu bar (some people have been using FontSize + FramePadding.y * 2 aka GetFrameHeight()). It shouldn't be an issue as very few people actually use style.DisplaySafeAreaPadding (and certainly not on computer platforms).

@mcmara
Copy link

mcmara commented Jul 1, 2024

I noted that if the call to GetWindowSize() is done from within BeginMenuBar() / EndMenuBar() it returns a value (in my case 32) which is different from a call done from within BeginMainMenuBar() / EndMainMenuBar() (in my case 24).
Is this normal? The 2 menus appear of the same height, so I was expecting the same value.

Edit: instead, calling GetFrameHeight() from within BeginMenuBar() / EndMenuBar() seems returning the correct value (24 in my case).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
menus menu bars, menu items
Projects
None yet
Development

No branches or pull requests

3 participants