Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:15

POPUP/POPDOWN


Poster: dhaack
Dated: Tuesday August 10 2004 - 17:22:17 BST

Have two minor problems

1) Cannot get overflow="scroll" working with popup or displayMenu
Works fine with showmenu

2) If I have a large submenu that uses popup, then when mouseover closes properly. But actually justs hides, and does not reset mouse control under popup. (Example href link under popup cannot access until reset by going to main menu)

Again if called from showmenu, mouseover close resets mouse control properly

Any suggestions would be helpful

Thanks Dave


Poster: Ruth
Dated: Wednesday August 11 2004 - 22:28:00 BST

A url would be the most helpful thing in order to see what's going on. I just put a long long submenu into a pop menu and set it to overflow="scroll" it seemed to work OK. So, browser where the problem occurs, OS and a test page would be the most helpful so we can see what's happening. I'm not sure I understand what you're saying is going wrong.

Ruth

URL


Poster: dhaack
Dated: Thursday August 12 2004 - 1:07:54 BST

Cannot give out url, system in an accounting database system.

Key is pop menu is a submenu without left/top set, but location based on parent. System uses allBuildMenu and spos to set the pos of menu on return to set location.

System automatically opens submenu on load.

Here is function that gets pos from cookie, sets spos and calls popup

Thanks Dave

function getcookiemenu(mainmenu) {
var cookie = getcookie(mainmenu);
c1 = cookie.indexOf(",",0);
c2 = cookie.indexOf(",",c1+1);
c3 = cookie.indexOf(",",c2+1);
c4 = cookie.indexOf(",",c3+1);
menuinfo = cookie.substr(0,c1);
toppos = cookie.substr(c1+1,c2-c1-1);
leftpos = cookie.substr(c2+1,c3-c2-1);
heightpos = cookie.substr(c3+1,c4-c3-1);
widthpos = cookie.substr(c4+1,cookie.length);
if (toppos != "")
{
menuNumber = getMenuByName(menuinfo);
spos(gmobj("menu" + menuNumber),toppos,leftpos,null,null);
popup(menuinfo);
}
return
}


Poster: Andy
Dated: Thursday August 12 2004 - 9:42:51 BST

Have you tried the popi(itemnumber) function.

The only parameter you need for this is the item number for the parent item.

This will only work though if you have a main menu.

-- Andy

popi problem


Poster: dhaack
Dated: Thursday August 12 2004 - 11:03:20 BST

I do always have main menu displayed.

I can get itemnumber by using following function; but try to call popi(item#) and get errmsg saying object expected.

Do alert and do get an item number after calling following function

function mm_getItemByName(itemName)
{
for (i=0; i<_mi.length; i++) if (_mi[i][1].indexOf(itemName) != -1) return i;
return -1;
}

are you sure it is popi()? Maybe different spelling. am I missing something? Is popi function something I have to load

Thanks for the help

Dave


Poster: Andy
Dated: Thursday August 12 2004 - 13:02:09 BST

sorry the format is _popi(Int);

All menu items are numbered 0 to whatever - There are techniques that you can use to get the appropriate item number but let me know if it works for you first using hard coded values.

If it does, we can address the issue of returning the correct item number.

-- Andy

_popi


Poster: dhaack
Dated: Thursday August 12 2004 - 16:32:25 BST

no error message this time; but no submenus poping up.

Calling routine onload. Tried 0,1,2,5 for values.

Do I need to set the spos? keepalive? etc; I assumed system would figure out from parent.

Dave

test with popi


Poster: dhaack
Dated: Thursday August 12 2004 - 18:59:42 BST

I did some testing, and _popi does work if call after page is loaded; but when try to run calling onload does not.

Seems that even though onload is called, the routine wants to load before the main menu.

Any way to get routine to run after main menus are opened

Thanks for help Dave


Poster: Andy
Dated: Friday August 13 2004 - 8:35:41 BST

Is this any help?

http://www.milonic.com/openmenusbyurl.js

it opens the menus based on the current url.

-- Andy

openmenusbyurl.js


Poster: dhaack
Dated: Friday August 13 2004 - 9:45:38 BST

Tried, but no luck. No menus display except main menu.

I called routine after drawmenus() call; even tried before just in case. I assume problem is same as my problem. You are calling popi routine and it is being run before menus are drawn.

I put an alert 1st line in _ocURL() function to see if called after draw menus;

ocURL() is called 5 times; and 3-4 are called before main menu displays

Hope this helps you isolate problem

I assume we are close; mine is working well except for the scroll and url items after closed

Is there anyway to test that main menus are drawn before calling our routines?

Thanks for all your support; I am getting good responses from my clients

Dave

Re: openmenusbyurl.js


Poster: kevin3442
Dated: Friday August 13 2004 - 22:07:01 BST

Hi Dave,

dhaack wrote:
...Is there anyway to test that main menus are drawn before calling our routines?...


I have some functions that may help. You could put the following code at the top of you your menu_data.js file:

Code:
var runWhenOpenedTimer = 0;

function mm_isOpen(menuName)
{
  menuObj = gmobj("menu" + getMenuByName(menuName));
  if (ns4) {
    return (menuObj.visibility == "show");
  }
  else {
    return (menuObj.style.visibility != "hidden");
  }
}

function mm_runWhenOpened(menuName, functionToRun)
{
  var checkInterval = 100;  //msec
  var funcStr = "mm_runWhenOpened("" + menuName + "", " + """ + functionToRun + "")";

  if (! mm_isOpen(menuName)) {
    runWhenOpenedTimer = setTimeout(funcStr, checkInterval);
  }
  else {
    clearTimeout(runWhenOpenedTimer);
    runWhenOpenedTimer = setTimeout(functionToRun, 0);
  }
}

function testFunction(menuName)
{
  alert("I'm now doing whatever with the menu named: " + menuName);
}


mm_isOpen(menuName) is a function that checks to see if a menu is open. It takes one parameter, menuName, which is the name of the menu to check. e.g., mm_isOpen("Main Menu") will return true if the menu named "Main Menu" is open, false if not.

mm_runWhenOpened(menuName, functionToRun) is a recursive function that will check to see if a named menu is open, and after the named menu is open will run a specified function. The mm_runWhenOpened() takes two parameters. menuName is the name of the menu to wait for (wait until it's opened) and functionToRun is the function that you want to run once the named menu is open. funcitonToRun must be a string expression, with any passed parameters specified literally. If you want to include variable in the parameters to pass, then build functionToRun as a separate string before passing it to mm_runWhenOpened().

In the above code, there's an example function called testFunction() that you would replace with your own function (i.e., whatever you want to run after the main menu appears).

So, suppose my main menu is named "Main Menu". Once "Main Menu" is open, I want to run testFunction() and pass it the name of a sub menu called "Products Submenu". At the bottom of my menu_data.js, after the call to drawMenus(), I would put:

Code:
// first derive the name of the sub menu however you need to
var subMenuName = "Products Submenu";

// now build the function string to pass
var functionString = "testFunction('" + subMenuName + "')";

// start the waiting...
mm_runWhenOpened("Main Menu", functionString);


With my testFunction(), after the main menu appears, an alert pops up with the text, "I'm now doing whatever with the menu named: Products Submenu". You would, of course, substitute your own function (get cookies, pop a menu, etc.).

Hope that helps,

Kevin

run function on open routines


Poster: dhaack
Dated: Sunday August 15 2004 - 11:07:14 BST

Works perfectly; now I can use popi which handles scroll and href under menus properly.

Thanks for all your help

Dave