### MenuBar with Images

B4J Visual Designer Example MenuBar with Images.
Menu:
File
FileOpen
FileExit
Help
About
Images
fileopen.png
fileexit.png
helpabout.png
Copy the Images to the Project Files folder
Ensure to copy the required imagefiles to the project files folder, referred as dirassets folder.
Add the Images to the MenuBar Properties
In the B4J Visual Designer, select the Menubar.
Define the Menu as JSON string in the MenuBar Properties > Menu Items
[
{Text: "_File",
Children:
[
{Text:"_Open", Tag:"FileOpen", EventName: "FileOpen", Image: "fileopen.png"},
{Text: "_Exit", Tag:"FileExit", EventName: "FileExit", Image: "fileexit.png"}
]
},
{Text: "_Help",
Children:
[
{Text: "_About", Tag: "HelpAbout", EventName: "HelpAbout", Image: "helpabout.png"}
]
}
]
Create the B4J Code
Like
`Sub Process_Globals
...
Private MenuBar1 As MenuBar
...
End Sub`
`Sub FileOpen_Action
fx.Msgbox(MainForm, "File Open clicked.", "File Open")
End Sub`
`Sub FileExit_Action
fx.Msgbox(MainForm, "File Exit clicked.", "File Exit")
End Sub`
`Sub HelpAbout_Action
fx.Msgbox(MainForm, "Help About clicked.", "Help About")
End Sub`

Changed: 2018-04-09 11:11, Category: Menu, File: T6C220M1621.htm, ID: 1621