How to Use the Right Side of the Menu Bar

Just starting out? Need help? Post your questions and find answers here.
joebones
New User
New User
Posts: 7
Joined: Sun May 30, 2010 11:02 am

How to Use the Right Side of the Menu Bar

Post 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
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

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

Post 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
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
joebones
New User
New User
Posts: 7
Joined: Sun May 30, 2010 11:02 am

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

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