Page 1 of 1

MenuHeight()

Posted: Thu Jun 01, 2006 1:45 pm
by MLK
shouldn't it be MenuHeight(#Menu) ?

Posted: Thu Jun 01, 2006 2:44 pm
by ABBKlaus
:lol: i think there is only one menubar :idea:

Posted: Thu Jun 01, 2006 4:29 pm
by Trond
one menubar across many windows?

Posted: Fri Jun 02, 2006 12:10 am
by ABBKlaus
Trond why are you right always :oops:

But it would only make sense if PB could set the menuhight :wink:

http://msdn.microsoft.com/library/en-us ... nuinfo.asp

http://msdn.microsoft.com/library/en-us ... o.asp[url]

Posted: Fri Jun 02, 2006 10:28 am
by Trond
Well, the height doubles if the window is resized horizontally so that the menu is wider than the window. Then the menu will wrap to another line and will no longer have the same height.

Posted: Fri Jun 02, 2006 11:36 am
by ABBKlaus
This demonstrates how to retrieve the complete menuheight :

Code: Select all

#OBJID_MENU = $FFFFFFFD 

Structure MENUBARINFO
  cbSize.l
  rcBar.RECT
  hMenu.l
  hwndMenu.l
  fBarFocused.w
  fFocused.w
EndStructure

  If OpenWindow(0, 200, 200, 200, 100, "Menu Height",#PB_Window_SystemMenu|#PB_Window_SizeGadget)
    If CreateMenu(0, WindowID(0))    ; here the menu creating starts....
      MenuTitle("Menu 1")
      MenuTitle("Menu 2")
      MenuTitle("Menu 3")
      MenuTitle("Menu 4")
      MenuTitle("Menu 5")
      MenuTitle("Menu 6")
      MenuTitle("Menu 7")
      MenuTitle("Menu 8")
      MenuTitle("Menu 9")
    EndIf
  EndIf
  
  Repeat
    Event=WaitWindowEvent()
    Select Event
      Case #PB_Event_Repaint
        ;Debug MenuHeight()
        ;http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/resources/menus/menureference/menufunctions/getmenubarinfo.asp
        test.MENUBARINFO
        test\cbSize=SizeOf(MENUBARINFO)
        If GetMenuBarInfo_(WindowID(0),#OBJID_MENU,0,test)
          Debug test\rcBar\bottom-test\rcBar\top
        EndIf
    EndSelect
  Until Event=#PB_Event_CloseWindow