LWGShane Well-Known Member Licensed User Longtime User May 5, 2017 #1 With the B4J Designer, you can add ContextMenus like the below to any control. Example ContextMenu: ["Item 1", "Item 2"] However, what is the code for actually using them? I've tried the below code and it doesn't work. B4X: Public Sub MenuItem_Action Dim Mi As MenuItem = Sender Log (Mi.Text) End Sub Any help would be appreciated!
With the B4J Designer, you can add ContextMenus like the below to any control. Example ContextMenu: ["Item 1", "Item 2"] However, what is the code for actually using them? I've tried the below code and it doesn't work. B4X: Public Sub MenuItem_Action Dim Mi As MenuItem = Sender Log (Mi.Text) End Sub Any help would be appreciated!
DonManfred Expert Licensed User Longtime User May 5, 2017 #2 You have seen this: https://www.b4x.com/android/forum/threads/designer-menu-items.56602/ Upvote 0
LWGShane Well-Known Member Licensed User Longtime User May 5, 2017 #3 DonManfred said: You have seen this: https://www.b4x.com/android/forum/threads/designer-menu-items.56602/ Click to expand... There's not an example in that thread that shows you how to use Menu Items created in the fashion I posted, ex: ["Context Item #1", "Context Item #2"] It's a ContextMenu and I tried the MenuItem_Action and that doesn't work. Upvote 0
DonManfred said: You have seen this: https://www.b4x.com/android/forum/threads/designer-menu-items.56602/ Click to expand... There's not an example in that thread that shows you how to use Menu Items created in the fashion I posted, ex: ["Context Item #1", "Context Item #2"] It's a ContextMenu and I tried the MenuItem_Action and that doesn't work.
Daestrum Expert Licensed User Longtime User May 5, 2017 #4 When you add the code for the context menu in the designer, add the EventName you want for the item too. At its simplest use B4X: [{Text: "item1",EventName: "one"},{Text: "item2",EventName: "two"}] Now when item1 is clicked it will trigger B4X: Sub one_Action ... End Sub Upvote 0
When you add the code for the context menu in the designer, add the EventName you want for the item too. At its simplest use B4X: [{Text: "item1",EventName: "one"},{Text: "item2",EventName: "two"}] Now when item1 is clicked it will trigger B4X: Sub one_Action ... End Sub