MenuHeight()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
MLK
User
User
Posts: 57
Joined: Sat Jan 24, 2004 8:46 pm
Location: Germany

MenuHeight()

Post by MLK »

shouldn't it be MenuHeight(#Menu) ?
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

:lol: i think there is only one menubar :idea:
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

one menubar across many windows?
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post 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]
Last edited by ABBKlaus on Fri Jun 02, 2006 11:03 am, edited 1 time in total.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post 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
Post Reply