Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 12.2   12.3   12.4   12.5   13.0   13.1   13.2   13.3   13.4   13.5    Statistic    FMM    Blog  

Menu.NumberOfItems

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

Component Version macOS Windows Linux Server iOS SDK
Menu 4.1 ✅ Yes ✅ Yes ❌ No ❌ No ❌ No
MBS( "Menu.NumberOfItems"; menu )   More

Parameters

Parameter Description Example
menu The reference to the menu. Please create one with Menu.CreateMenu. $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"; $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"; item; 16 );
    // and continue with next item
    index = index + 1
] ; 0 )

See also

This function is free to use.

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


Menu.List - Menu.PopUp

💬 Ask a question or report a problem