LWGShane Well-Known Member Licensed User Longtime User Feb 1, 2017 #1 Error: "String can't be cast to MenuItem" Code: B4X: FileMenu.MenuItems.AddAll(Array As String("New Project"))
Error: "String can't be cast to MenuItem" Code: B4X: FileMenu.MenuItems.AddAll(Array As String("New Project"))
LWGShane Well-Known Member Licensed User Longtime User Feb 2, 2017 #3 stevel05 said: Which example code are you referring to? Click to expand... When you type "Menu.MenuItems.AddAll", the example in the popup: B4X: List.AddAll(Array As String("value1", "value2")) However, when you actually use "Array As String()" inside the "AddAll" function it says "String can't be cast to MenuItem".
stevel05 said: Which example code are you referring to? Click to expand... When you type "Menu.MenuItems.AddAll", the example in the popup: B4X: List.AddAll(Array As String("value1", "value2")) However, when you actually use "Array As String()" inside the "AddAll" function it says "String can't be cast to MenuItem".
Erel B4X founder Staff member Licensed User Longtime User Feb 2, 2017 #4 This is not a bug. MenuBar.Menus returns a regular List. When you write MenuBar.Menus.AddAll the IDE shows you the documentation of List.AddAll. There are many advantages for providing access to a List instead of adding methods such as: MenuBar.AddMenuItem(...) MenuBar.Remove(...) The downside is that you do see the documentation of a regular List.
This is not a bug. MenuBar.Menus returns a regular List. When you write MenuBar.Menus.AddAll the IDE shows you the documentation of List.AddAll. There are many advantages for providing access to a List instead of adding methods such as: MenuBar.AddMenuItem(...) MenuBar.Remove(...) The downside is that you do see the documentation of a regular List.
LWGShane Well-Known Member Licensed User Longtime User Feb 2, 2017 #5 @Erel - Oh alright. Good to know that it's intentional. You can lock this thread.