Alberto Michelis Well-Known Member Licensed User Longtime User Jun 4, 2015 #1 Hi, Any way of having a menu definition in one module and use it in all the activities of the app? And where can I found the icon of this menu? Are they an android resource I can use? see image. Thanks Attachments 2015-06-04_0730.png 56.4 KB · Views: 349 Last edited: Jun 4, 2015
Hi, Any way of having a menu definition in one module and use it in all the activities of the app? And where can I found the icon of this menu? Are they an android resource I can use? see image. Thanks
Erel B4X founder Staff member Licensed User Longtime User Jun 4, 2015 #3 You can use a class to add the menu items (pass the activity as a parameter to the class). The menu click event will still fire on the activity module. You can use a single event for all the menu items and then delegate it to the class. This will allow you to share the code between all the modules: Code: Sub Menu_Click MenuHandlerClassInstance.MenuClick(Sender) 'sender will be the menu text End Sub Upvote 0
You can use a class to add the menu items (pass the activity as a parameter to the class). The menu click event will still fire on the activity module. You can use a single event for all the menu items and then delegate it to the class. This will allow you to share the code between all the modules: Code: Sub Menu_Click MenuHandlerClassInstance.MenuClick(Sender) 'sender will be the menu text End Sub
Alberto Michelis Well-Known Member Licensed User Longtime User Jun 4, 2015 #4 It is this or I need to add the menu, items and click code in all the activities? Thats what you normally do? May exists a compiler INCLUDE(file) to include the same code in many modules? Upvote 0
It is this or I need to add the menu, items and click code in all the activities? Thats what you normally do? May exists a compiler INCLUDE(file) to include the same code in many modules?
Erel B4X founder Staff member Licensed User Longtime User Jun 5, 2015 #5 You can add the menus from the class code. This is why you need to pass the activity object to the class. You only need to have one event sub in the activity that will delegate the event to the class instance. Upvote 0
You can add the menus from the class code. This is why you need to pass the activity object to the class. You only need to have one event sub in the activity that will delegate the event to the class instance.