Right Click context menu how do I close it before I load it?
-
- Super Advanced
- Posts: 49
- Joined: Sat Aug 21, 2004 2:57 pm
Right Click context menu how do I close it before I load it?
I have implemented frames on my website and as I wish to continue the right click menu across the frames, I have implemented the right click context menu on each page within the frames. This causes a major problem because now I can actually have several of the right click menus open at once (one on each frame).
Is it possible to close any open right click menus on any frame when someone right clicks again on any of the frames?
Thanks
Dave
Is it possible to close any open right click menus on any frame when someone right clicks again on any of the frames?
Thanks
Dave
Hi Dave,
The good news is that is should be possible. To do what you want would require looping through the frames and closing menus that are open in those frames before opening the new menu. The not-so-good news is that you'd have to edit the event handler that opens the context menu. That code is in contextmenu.js, which is copyrighted by Milonic, so it's not really for me to just edit as I see fit. I'll check to see if it's do-able.
Kevin
The good news is that is should be possible. To do what you want would require looping through the frames and closing menus that are open in those frames before opening the new menu. The not-so-good news is that you'd have to edit the event handler that opens the context menu. That code is in contextmenu.js, which is copyrighted by Milonic, so it's not really for me to just edit as I see fit. I'll check to see if it's do-able.
Kevin
-
- Super Advanced
- Posts: 49
- Joined: Sat Aug 21, 2004 2:57 pm
Thanks Kevin
If you could do that for me and get back to me about it that would be great, thanks
Dave
Dave
-
- Super Advanced
- Posts: 49
- Joined: Sat Aug 21, 2004 2:57 pm
Slight Problem
I just checked and I am not implementing the contextmenu.js file, I am only implementing: menu_data.js, milonic_src.js and mmenudom.js. The right click menu seems to be running fine though, what functionality does the contextmenu.js file bring to the menu?
Thanks
Dave
Thanks
Dave
Re: Slight Problem
Hi Dave,
I have sent a note about the situation to Milonic. I'll report any answer I get back here.
Cheers,
Kevin
contextmenu.js provides the functionality for context menus, so you must be using the code somewhere. Out of curiosity, I had a look at some of your earlier posts. At some point, you moved the essential code from contextmenu.js into your menu_data.js file. So, your menu_data.js file contains the event handler that's normally defined in contextmenu.js.darkcircuituk wrote:I just checked and I am not implementing the contextmenu.js file, I am only implementing: menu_data.js, milonic_src.js and mmenudom.js. The right click menu seems to be running fine though, what functionality does the contextmenu.js file bring to the menu?
I have sent a note about the situation to Milonic. I'll report any answer I get back here.
Cheers,
Kevin
-
- Super Advanced
- Posts: 49
- Joined: Sat Aug 21, 2004 2:57 pm
Excellent, Thanks
Thats great, thank you very much!
-
- Super Advanced
- Posts: 49
- Joined: Sat Aug 21, 2004 2:57 pm
Got an Answer Yet Kevin?
Hey Kevin, you got an answer back from Milonic yet?
-
- Super Advanced
- Posts: 49
- Joined: Sat Aug 21, 2004 2:57 pm
Errrmmmm not too sure
Errrrrrrrr won't that just close all open menus if they are within the same js file, my problem is I am using two seperate js files, one for each different menu :-S
I can send you an example of what I am trying to achieve!
I can send you an example of what I am trying to achieve!
Hi Dave,
Sorry it took me so long to reply. I've been traveling for the past couple of weeks and haven't had much time for the net.
I think Andy's post suggests pretty much the same thing I was suggesting. Calling the built-in closeAllMenus() function in each of the frames before opening the next context menu should take care of the issue. Seems to me the logical place to do thath would be withing the right-click event handler (which is normally defined in contextmenu.js, but which you seem to have moved into your menu_data.js file).
Suppose, for example, that you have three frames named "header", "side", and "body". You could find the following code:
and change it to:
You would, of course, make your code appropriate to the number of frames you have as well as their actual names. How you address the frames from the top would also depend on whether or not you have any nested frames.
Here's another option:
Another approach you could take would be to apply slight left and top offset to each your context menus, moving them slightly up and to the left when they open. Offset the menus just enough so that when they open, the pointer is automatically inside of the menu, highlighting the first item. That way, if the user decides not to do anything with the open menu, when he or she moves the pointer out of the menu, the menu will close automatically.
To apply an "up and left" offset, you'd use the top and left properties in the menu definition, like so:
If you didn't want the first active item to be highlighted automatically, then you could use a header item at the top of the menu.
Hope that helps,
Kevin
Sorry it took me so long to reply. I've been traveling for the past couple of weeks and haven't had much time for the net.
I think Andy's post suggests pretty much the same thing I was suggesting. Calling the built-in closeAllMenus() function in each of the frames before opening the next context menu should take care of the issue. Seems to me the logical place to do thath would be withing the right-click event handler (which is normally defined in contextmenu.js, but which you seem to have moved into your menu_data.js file).
Suppose, for example, that you have three frames named "header", "side", and "body". You could find the following code:
Code: Select all
function rclick(e){
if(contextDisabled)
{
_d.oncontextmenu=null
return true;
}
if(_d.all)
{
ev=event.button;
contextObject=event.srcElement
}
<... etc ...>
}
Code: Select all
function rclick(e){
if(contextDisabled)
{
_d.oncontextmenu=null
return true;
}
top.header.closeAllMenus();
top.side.closeAllMenus();
top.body.closeAllMenus();
if(_d.all)
{
ev=event.button;
contextObject=event.srcElement
}
<... etc ...>
}
Here's another option:
Another approach you could take would be to apply slight left and top offset to each your context menus, moving them slightly up and to the left when they open. Offset the menus just enough so that when they open, the pointer is automatically inside of the menu, highlighting the first item. That way, if the user decides not to do anything with the open menu, when he or she moves the pointer out of the menu, the menu will close automatically.
To apply an "up and left" offset, you'd use the top and left properties in the menu definition, like so:
Code: Select all
with(milonic=new menuname("contextMenu")){
top="offset=-3";
left="offset=-3";
style = contextStyle;
margin=3
aI("text=Milonic Home Page;url=/;image=http://milonic.com/images/home.gif");
aI("text=Print;url=javascript:window.print();separatorsize=1;image=http://milonic.com/images/print.gif");
<...etc...>
}
Hope that helps,
Kevin