Hi Cubefree,
I think what'sgoing on is that you are passing an object (the return of gmobj()) as the first parameter to menuDisplay(). But don't feel bad... I think your brain cells are just fine, becasue I see that you're doing it exactly the way the docs on the "Methods and Functions" page describe. Problem is, after having a look, I thing the docs for the menuDisplay() function are wrong. I've been messing with that function since before the docs page appeared, and I'm certain that the first parameter passed to menuDisplay() is an integer, which is used as an index into the _m[] array (look at the function definition in mmenudom.js, and you'll see that the first parameter is passed into the function as _mD, which is used as an index into _m[] menu array). So, you should be able to take the return of getMenuByName() and pass it as the first parameter into menuDisplay(), like so:
Code: Select all
menuName = 'Milonic';
menuNum = getMenuByName(menuName);
menuDisplay(menuNum,1);
or, more directly:
Code: Select all
menuName = 'Milonic';
menuDisplay(getMenuByName(menuName),1)
You may have to pay attention to whether the menu you want to open already has coordinatesw at which to open. If not, it probably won't open (You can set position with the spos() function).
Speaking of which... I think your call to gpos() also has a problem. The example in the docs refers to "menu1" but that's a little confusing... it's not the whole story. "menu1" is really an internal reference... i.e., every menu system has an internal menu1, menu2, etc. But you don't know directly which menu is menu1, which is menu2, etc. You have to get that info out of the menu system as an intermediate step. You do know the menu names you used in your menu_data.js, so you start there. You have to take the text "menu" and append the menu number of the menu of interest. The menu number is the index in the _m[] array where the menu of interest will be found. But how do you get that number??? ... conveniently, it happens to be the return of getMenuByName(), which takes your
menu name as a parameter (see... you knew I'd get back to the names, right?). So, in your specific example, instead of
Code: Select all
var menuPosition = gpos( gmobj("Milonic") );
try
Code: Select all
var menuPosition = gpos(gmobj("menu" + getMenuByName("Milonic")));
Hope that made sense, and hope it helps.
Kevin