Just re-register the menu.
For example:
function swap()
menu[1], menu[2] = menu[2], menu[1]
toolpalette.register(menu)
end
menu = {
{"Analysis",
{"Decimal", print},
{"Hexadecimal", print},
{"Octal", print},
{"Binary", print},
{"Signed", print},
{"Unsigned", print},
},
{"Boolean",
{"And", print},
{"Or", print},
{"XOr", print},
{"Not", print},
},
{"Toggle",
{"Swap menu", swap}
}
}
function on.construction()
toolpalette.register(menu)
end
When clicking on swap, the first two menus will always be swapped. Silly example, but it shows that you dynamically can change the menu items.