@ColdChemical, I've updated the code. You can change the images and remove the background colour I added - I just used them fr contrast.
// ==PREPROCESSOR==
// @name "MainMenuManager All-In-One"
// @author "YBStone / T.P Wang / marc2003"
// @import "%fb2k_component_path%docs\flags.txt"
// @import "%fb2k_component_path%docs\helpers.txt"
// ==/PREPROCESSOR==
var tooltip = window.CreateTooltip();
var b = new buttons();
var normal_img = fb.ComponentPath + "samples\\complete\\images\\misc\\menu white.png";
var hover_img = fb.ComponentPath + "samples\\complete\\images\\misc\\menu black.png";
b.update = function (pressed) {
this.buttons.menu = new button(0, 0, 60, 60, {normal : pressed ? hover_img : normal_img, hover: hover_img},function () { menu(); }, "");
window.Repaint();
}
b.update();
function on_paint(gr) {
gr.FillSolidRect(0, 0, window.Width, window.Height, RGB(255, 0, 0));
b.paint(gr);
}
function on_mouse_move(x, y) {
b.move(x, y);
}
function on_mouse_lbtn_up(x, y) {
b.lbtn_up(x, y);
}
function on_mouse_leave(x, y) {
b.leave();
}
function menu() {
var basemenu = window.CreatePopupMenu();
var contextman = fb.CreateContextMenuManager();
contextman.InitNowPlaying();
var child1 = window.CreatePopupMenu(); //File
var child2 = window.CreatePopupMenu(); //Edit
var child3 = window.CreatePopupMenu(); //View
var child4 = window.CreatePopupMenu(); //Playback
var child5 = window.CreatePopupMenu(); //Library
var child6 = window.CreatePopupMenu(); //Help
var child7 = window.CreatePopupMenu(); //Now playing
var child8 = window.CreatePopupMenu(); //cherry test
var child9 = window.CreatePopupMenu(); //apple test
var menuman1 = fb.CreateMainMenuManager();
var menuman2 = fb.CreateMainMenuManager();
var menuman3 = fb.CreateMainMenuManager();
var menuman4 = fb.CreateMainMenuManager();
var menuman5 = fb.CreateMainMenuManager();
var menuman6 = fb.CreateMainMenuManager();
// MF_STRING is defined in docs\flags.txt
child1.AppendTo(basemenu, MF_STRING, "File");
child2.AppendTo(basemenu, MF_STRING, "Edit");
child3.AppendTo(basemenu, MF_STRING, "View");
child4.AppendTo(basemenu, MF_STRING, "Playback");
child5.AppendTo(basemenu, MF_STRING, "Library");
child6.AppendTo(basemenu, MF_STRING, "Help");
child7.AppendTo(basemenu, MF_STRING, "Now Playing");
basemenu.AppendMenuSeparator();
child8.AppendTo(basemenu, MF_STRING, "CHERRY");
child8.AppendMenuItem(MF_STRING, 7501, "cherries in my mouth [Console]");
child8.AppendMenuItem(MF_STRING, 7502, "cherries in my hand [Open]");
basemenu.AppendMenuItem(MF_STRING, 8000, "Preferences (Apple)");
menuman1.Init("file");
menuman2.Init("edit");
menuman3.Init("View");
menuman4.Init("playback");
menuman5.Init("library");
menuman6.Init("help");
menuman1.BuildMenu(child1, 1, 200);
menuman2.BuildMenu(child2, 201, 200);
menuman3.BuildMenu(child3, 401, 300);
menuman4.BuildMenu(child4, 601, 300);
menuman5.BuildMenu(child5, 901, 300);
menuman6.BuildMenu(child6, 1201, 100);
contextman.InitNowPlaying();
contextman.BuildMenu(child7, 1301, -100);
var menuY = b.buttons.menu.h + b.buttons.menu.y + 4;
b.update(true);
ret = basemenu.TrackPopupMenu(b.buttons.menu.x, menuY);
b.update();
switch (true) {
case(ret >= 1 && ret < 201):
menuman1.ExecuteByID(ret - 1);
break;
case (ret >= 201 && ret < 401):
menuman2.ExecuteByID(ret - 201);
break;
case (ret >= 401 && ret < 601):
menuman3.ExecuteByID(ret - 401);
break;
case (ret >= 601 && ret < 901):
menuman4.ExecuteByID(ret - 601);
break;
case (ret >= 901 && ret < 1201):
menuman5.ExecuteByID(ret - 901);
break;
case (ret >= 1201 && ret < 1301):
menuman6.ExecuteByID(ret - 1201);
break;
case (ret >= 1301 && ret < 2000): //case (ret >= 1301):
contextman.ExecuteByID(ret - 1301);
break;
case (ret == 7501):
fb.RunMainMenuCommand("View/Console");
break;
case (ret == 7502):
fb.RunMainMenuCommand("File/Open...");
break;
case (ret == 8000):
fb.RunMainMenuCommand("File/Preferences");
break;
}
basemenu.Dispose();
contextman.Dispose();
menuman1.Dispose();
menuman2.Dispose();
menuman3.Dispose();
menuman4.Dispose();
menuman5.Dispose();
menuman6.Dispose();
}
@always.beta - that script loads fine for me. Behaviour seems buggy but it doesn't crash.