Menu.NumberOfItems
------------------

Returns the number of menu items in the menu, including separator items.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Menu](component_Menu.md) | [4.1](newinversion41.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "Menu.NumberOfItems"; menu ) 

**MBS**( **"Menu.NumberOfItems";** /\* Returns the number of menu items in the menu, including separator items. \*/  
**$menu**) /\* The reference to the menu. Please create one with [Menu.CreateMenu](MenuCreateMenu.md). \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| menu | The reference to the menu. Please create one with [Menu.CreateMenu](MenuCreateMenu.md). | $menu |

### Result

Returns number or error.

### Description

Returns the number of menu items in the menu, including separator items.  
### Examples

Loop over all menuitems in a menu and change font size:

 While (   
\[  
 // get items in menu   
 items = MBS ( "[Menu.Items](MenuItems.md)"; $menu );   
 index = 1;  
 count = MBS ( "Menu.NumberOfItems"; $menu )  
\] ;   
  
// loop till last item  
index ≤ count ;   
  
\[   
 // get the current item  
 item = GetValue(items; index);  
 // change font size  
 r = MBS ( "[MenuItem.SetFontSize](MenuItemSetFontSize.md)"; item; 16 );   
 // and continue with next item  
 index = index + 1  
\] ; 0 )  
### See also

- [Menu.CreateMenu](MenuCreateMenu.md)
- [Menu.ItemAtIndex](MenuItemAtIndex.md)
- [Menu.Items](MenuItems.md)
- [Menu.RemoveItemAtIndex](MenuRemoveItemAtIndex.md)
- [MenuItem.SetFontSize](MenuItemSetFontSize.md)

### FileMaker Magazin

- [Ausgabe 2/2021, Seite 30](https://filemaker-magazin.de/neuigkeit/4132-Appetithappen-FMM_202102)

This function is free to use.

Created 18th August 2014 , last changed 12nd March 2021

  
[Menu.List](MenuList.md) - [Menu.PopUp](MenuPopUp.md)

[HTML Version](MenuNumberOfItems.shtml)