Code: Select all
Procedure menuRJustify(hWnd.l, menuindex.l)
  ; menuindex is the index of the main menu, counting from 0.
  Define.l hMenu
  Define.MENUITEMINFO mnuIteminfo
  hMenu = GetMenu_(hwnd)
  With mnuItemInfo
    \cbSize = SizeOf(menuiteminfo)
    \fMask = #MIIM_FTYPE
    GetMenuItemInfo_(hMenu, menuindex, #True, mnuiteminfo)    
    \fType = \fType | #MFT_RIGHTJUSTIFY
    SetMenuItemInfo_(hMenu, menuindex, #True, mnuiteminfo)
  EndWith
  ; This makes the changes stick!
  DrawMenuBar_(hwnd)  ; Repaint top level Menu
EndProcedure
If OpenWindow(0, 100, 200, 195, 260, "Help Menu Right Justified", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
  hWnd= WindowID(0)
  If CreateMenu(0, WindowID(0))
    MenuTitle("Project")
      MenuItem(0, "New")
      MenuItem(1, "Open")
      MenuItem(2, "Save")
    MenuTitle("Tool")
      MenuItem(0, "1")
      MenuItem(1, "2")
      MenuItem(2, "3")
    MenuTitle("Help")
      MenuItem(0, "1")
      MenuItem(1, "2")
      MenuItem(2, "3")
  EndIf
  menuRJustify(hWnd, 2)  ; 0-based index of main menu items to right justify
  Repeat
    Event = WaitWindowEvent()
    Select Event
    Case #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndSelect
  Until Quit = 1
EndIf
End



