I need an event when the menu is closed

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Tony Fleig
Beginner
Beginner
Posts: 3
Joined: Fri Dec 30, 2005 1:17 pm

I need an event when the menu is closed

Post by Tony Fleig »

I need to take action when my menu is closed.

I need to do it whether the menu is closed by a popdown() function call or by the user clicking on a menu item or a menu timeout or the user clicking elsewhere on the page.

Is there a way to do this? What I'm looking for is somewhere I can specify an "onmenuclose" function or something similar.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I dont' know if the following links will help.

http://milonic.com/menusample15.php

http://support.milonic.com/demos/

The demos have something called setTimeOut which as something to do with functions. There are a lot of functions there, soem of which can be put on pages.

Sorry, but there doesn't seem to be anyone on the forum now that does functions.

Ruth
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Re: I need an event when the menu is closed

Post by kevin3442 »

Tony Fleig wrote:I need to take action when my menu is closed.

I need to do it whether the menu is closed by a popdown() function call or by the user clicking on a menu item or a menu timeout or the user clicking elsewhere on the page.

Is there a way to do this? What I'm looking for is somewhere I can specify an "onmenuclose" function or something similar.
Hi Tony,

I haven't been on the forum for a long time, but happened to stop by tonight. This intriguing problem caught my attention. There is no such property, although it was discussed at one time. I don't know if it will eventually be implemented, but I can certainly see some good uses for an onclose property.

In the meantime, I have an idea that might work... basically constructing your own onclose event. But its execution depends on some specifics. Are you looking to fire an "onclose-like" event for any possible menus (possibly with multipe open menus at one time), just one specific menu, or multiple possible menus but only one menu open at a time?

Cheers,

Kevin
Tony Fleig
Beginner
Beginner
Posts: 3
Joined: Fri Dec 30, 2005 1:17 pm

Post by Tony Fleig »

Hi. Thanks for responding.

For my application I use multiple menus with only one open at a time.

I can see this being a common requirement as more and more application logic moves to the browser as AJAX clients become the norm. In my case, I have document elements that are disabled while a menu is up and must be re-enabled when the menu has closed.

I have implemented a setInterval-based method of doing this for now, checking to see whether the a menu is visible, but it is in essence unsatisfactory as a long-term solution.
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi All,

Just thought I'd step in here.

There are a couple of hooks you can use.

One is M_hideLayer() and the other is mmVisFunction()

The mmVisFunction() function will fire when every menu is opened and closed and passed to it are the menu object and a show/hide flag.

The M_hideLayer() function will fire when menu sets are opened and closed and passed to it are the menu object and a show/hide flag.


These functions are empty by default, all you have to do is put you're own code inside them, here's an example:

Code: Select all

function M_hideLayer()
{
	// args[0] is the menu object reference
	// args[1] is the show flag - one(1)  for show, zero(0) for hide
	args=arguments;
	window.status=args[0] + " - " + args[1]
}
One day, I'll be able to document everything that this menu does and is capable of 8)

Hope this helps,
Andy
Tony Fleig
Beginner
Beginner
Posts: 3
Joined: Fri Dec 30, 2005 1:17 pm

Post by Tony Fleig »

Andy that sounds like exactly what I need. Thanks a lot!

Of course now I'm wondering what other neat hooks there are that I don't know about...
Post Reply