valentino s Active Member Licensed User Longtime User Apr 21, 2016 #1 My first steps in menus on b4j. B4X: [ {Text: "_File", Children: [ "_New", "_Save", {Text: "_Export", Children: ["Zip File", "Tar File"]}, "-", "_Close" ] }, {Text: "_Google", EventName: "mnuitem", Tag: "Google" ,Children:[] }, {Text: "_Edit", Children:[] }, {Text: "_Help", Children: [ {Text: "Item With Unique Event Name", EventName: "mnuitem", Tag: "Unique"}, ] } ] the event mnuitem is raised only in children item: "Item With Unique Event Name" and not the item with text: "_Google". B4X: Sub MenuBar1_Action Dim mi As MenuItem = Sender Log (mi) If mi.Text = "_Google" Then WebView1.LoadUrl ("http://www.google.it") End If End Sub Where's my mistake ? Is there a simple full menu example to download and test with events on menu item and sub items ? Thanks in advance
My first steps in menus on b4j. B4X: [ {Text: "_File", Children: [ "_New", "_Save", {Text: "_Export", Children: ["Zip File", "Tar File"]}, "-", "_Close" ] }, {Text: "_Google", EventName: "mnuitem", Tag: "Google" ,Children:[] }, {Text: "_Edit", Children:[] }, {Text: "_Help", Children: [ {Text: "Item With Unique Event Name", EventName: "mnuitem", Tag: "Unique"}, ] } ] the event mnuitem is raised only in children item: "Item With Unique Event Name" and not the item with text: "_Google". B4X: Sub MenuBar1_Action Dim mi As MenuItem = Sender Log (mi) If mi.Text = "_Google" Then WebView1.LoadUrl ("http://www.google.it") End If End Sub Where's my mistake ? Is there a simple full menu example to download and test with events on menu item and sub items ? Thanks in advance
Erel B4X founder Staff member Licensed User Longtime User Apr 21, 2016 #2 Top menu items do not raise events. Note that it is better to check the tag property instead of the text. Upvote 0
Top menu items do not raise events. Note that it is better to check the tag property instead of the text.
alwaysbusy Expert Licensed User Longtime User Dec 16, 2016 #3 I'm in a similar position where I would like to use a top item without children. Erel said: Top menu items do not raise events. Click to expand... So what is the point of building such an item (without children) if the user can't click it anyway (or at least we do not get an event)? valentino s said: {Text: "_Edit", Children:[] }, Click to expand... Upvote 0
I'm in a similar position where I would like to use a top item without children. Erel said: Top menu items do not raise events. Click to expand... So what is the point of building such an item (without children) if the user can't click it anyway (or at least we do not get an event)? valentino s said: {Text: "_Edit", Children:[] }, Click to expand...
Erel B4X founder Staff member Licensed User Longtime User Dec 18, 2016 #4 There is indeed no point. It is just a placeholder. Upvote 0