Gtk. How do I create a submenu?

I’m still a beginner at Gtk GUI interface package.
I’ve googled a lot, but I can’t find any code snippets for how to create a submenu in Julia.
Could someone please advise.

Have tried obj=Gtk.GAccessor.submenu(aMenuItem) and the error is UndefRefError: access to undefined reference

Finally sussed it:

using Gtk, Gtk.ShortNames

file = MenuItem(“_File”)
filemenu = Menu(file)

new_ = MenuItem(“New”)
push!(filemenu, new_)
open_ = MenuItem(“Open”)
push!(filemenu, open_)
push!(filemenu, SeparatorMenuItem())
quit = MenuItem(“Quit”)
push!(filemenu, quit)

a_submenu = Menu()
diddly = MenuItem(“diddly”)
push!(a_submenu, diddly)
diddlydoo = MenuItem(“diddlydoo”)
push!(a_submenu, diddlydoo)

Gtk.GAccessor.submenu(open_, a_submenu)

mb = MenuBar()
push!(mb, file) # notice this is the “File” item, not filemenu

win = Window(mb, “Menus”, 200, 40)
showall(mb)

1 Like