diff --git a/menu.ts b/menu.ts index eb5eda5..fb97770 100644 --- a/menu.ts +++ b/menu.ts @@ -1,4 +1,6 @@ +enum MenuItemProperty {Font, Text, Icon} + namespace miniMenu{ /** @@ -27,4 +29,24 @@ namespace miniMenu{ return myMenu } + /** + * Returns a property of a given menu item + */ + //% blockId=getMenuItemProperty + //% block="get $menuItem $property" + //% group="Create" + //% weight=60 + + export function getMenuItemProperty(menuItem: MenuItem, property: MenuItemProperty): any{ + if (property == MenuItemProperty.Font){ + return menuItem.font; + } + else if (property == MenuItemProperty.Text){ + return menuItem.text; + } + else if (property == MenuItemProperty.Icon){ + return menuItem.icon + } + return + } } \ No newline at end of file