Can someone help me using the new AppendTo method?
This is a sample code:
function CustomMenu(x, y) {
var a = window.CreatePopupMenu();
var idx;
a.AppendMenuItem(0, 1, "Keep aspect ratio");
a.AppendMenuItem(0, 2, "Noexpansion");
a.AppendMenuItem(0, 3, "Stretch");
a.CheckMenuRadioItem(1, 3, ar + 1);
a.AppendMenuItem(2048, 0, 0);
a.AppendMenuItem(0, 4, at ? "Album Art" : "Custom Pictures");
a.AppendMenuItem(2048, 0, 0);
if (!ac) {
for (var i = 0; i < c_arr.length; i++) {
a.AppendMenuItem(0, 5 + i, c_arr[i]);
}
a.CheckMenuRadioItem(5, 9, g_state + 5);
a.AppendMenuItem(2048, 0, 0);
}
a.AppendMenuItem(ac ? 8 : 0, 10, "Auto Cycle Image");
ac && a.AppendMenuItem(ct ? 8 : 0, 11, "Faded Transition");
a.AppendMenuItem(2048, 0, 0);
a.AppendMenuItem(0, 12, "Properties");
a.AppendMenuItem(0, 13, "Configure...");
idx = a.TrackPopupMenu(x, y);
switch (true) {
case (idx >= 1 && idx <= 3):
window.SetProperty("Aspect ratio", idx - 1);
aspectRatio();
window.Repaint();
break;
case (idx == 4):
switchType();
break;
case (idx >= 5 && idx <= 9):
g_state = idx - 5;
getRightImage(false);
getTimer();
break;
case (idx == 10):
window.SetProperty("Auto Cycle Image", ac ? false : true);
ac = window.GetProperty("Auto Cycle Image");
break;
case (idx == 11):
window.SetProperty("Auto Cycle Transition Fader on", ct ? false : true);
ct = window.GetProperty("Auto Cycle Transition Fader on");
break;
case (idx == 12):
window.ShowProperties();
break;
case (idx == 13):
window.ShowConfigure();
break;
}
a.Dispose();
}
How to rewrite it now by using AppendTo instead of AppendMenuItem?
Or is this new method only needed for the MainMenuManager (since its the only sample script that uses it now) to create the main menu?
I'm confused...