Page 1 of 1

How to Use the Right Side of the Menu Bar

Posted: Thu Jun 24, 2010 8:37 am
by joebones
Hi --

Is there a way to make a menu title on the right side of the menu bar (like "Help" in the image below)?


Image


-----
Platform: WinXP(SP2)
Proc: Intel, 3Ghz
PB Ver: 4.40

Re: How to Use the Right Side of the Menu Bar

Posted: Thu Jun 24, 2010 10:32 am
by gnozal
Windows only.

Code: Select all

Enumeration
  #Window_0
EndEnumeration
Enumeration
  #Menu_Window_0
EndEnumeration
Enumeration
  #Menu_Window_0_Item1
  #Menu_Window_0_Item2
  #Menu_Window_0_Item3
EndEnumeration
Procedure MenuTitleRight(hWindow.l, hMenu.l, MenuIndex.l) ; Not working on NT4
  Protected ThisMenuItemInfo.MENUITEMINFO
  ThisMenuItemInfo\cbSize = SizeOf(MENUITEMINFO)
  ThisMenuItemInfo\fMask = #MIIM_FTYPE
  GetMenuItemInfo_(hMenu, MenuIndex, #True, ThisMenuItemInfo)    
  ThisMenuItemInfo\fType = ThisMenuItemInfo\fType | #MFT_RIGHTJUSTIFY
  SetMenuItemInfo_(hMenu, MenuIndex, #True, ThisMenuItemInfo)
  DrawMenuBar_(hWindow)
EndProcedure
If OpenWindow(#Window_0, 450, 200, 400, 419, "MenuTitleRight", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
  If CreateMenu(#Menu_Window_0, WindowID(#Window_0))
    MenuTitle("Title 1") ; 0
    MenuItem(#Menu_Window_0_Item1, "Item 1")
    MenuItem(#Menu_Window_0_Item2, "Item 2")
    MenuTitle("Title 2") ; 1
    MenuItem(#Menu_Window_0_Item3, "Item 3")
    ;
    MenuTitleRight(WindowID(#Window_0), MenuID(#Menu_Window_0), 1)
    ;
    Repeat
      Event = WaitWindowEvent()
      Select Event
        Case #PB_Event_CloseWindow
          Break
      EndSelect
    ForEver
  EndIf
EndIf

Re: How to Use the Right Side of the Menu Bar

Posted: Thu Jun 24, 2010 4:37 pm
by joebones
Gnozal --

Thank you for your fast and kind response. Yes, this does exactly as I hoped.

I appreciate your time and skill ! :D