B4J Question Menuitem without childrens: where's the event ?

valentino s

Active Member
Licensed User
Longtime User
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
 

alwaysbusy

Expert
Licensed User
Longtime User
I'm in a similar position where I would like to use a top item without children.

Top menu items do not raise events.
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)?

{Text: "_Edit", Children:[] },
 
Upvote 0
Top