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:10

Right-click Context menu


Poster: CyrixInstead
Dated: Wednesday September 24 2003 - 3:07:07 BST

I noticed a new function on the Milonic site that shows a right-click context menu. Currently, the link to download is the standard horizontal menu.

I like it very much, and was wondering if anyone could tell me when it would become available to use/download.


~Cyrix


Poster: John
Dated: Wednesday September 24 2003 - 3:09:50 BST

Pretty nifty, isn't it?

Andy is up to his eyeballs in projects right now, but we're workin' on him. Stay tuned!


Poster: CyrixInstead
Dated: Wednesday September 24 2003 - 3:11:12 BST

Yeah it's very cool, and looks very professional.

I can't wait to add it to my site and make that look more professional!

~Cyrix


Poster: John
Dated: Wednesday September 24 2003 - 3:13:07 BST

Trust me, everything Andy does is professional - period.

For now just enjoy the menu system - this will come...


Poster: Maz
Dated: Wednesday September 24 2003 - 7:56:18 BST

Please explain, I don't see it.
Thanks
maz


Poster: CyrixInstead
Dated: Wednesday September 24 2003 - 13:41:00 BST

Just go to the main Milonic website i.e. http://www.milonic.com and right-click your mouse. Rather than the standard Windows context menu you get a cool Milonic one.

~Cyrix


Poster: John
Dated: Wednesday September 24 2003 - 14:33:54 BST

Unless you've got a 2 or 3 button mouse on that thing, it won't work, Maz. You might try a Cmd-click.


Poster: Maz
Dated: Wednesday September 24 2003 - 16:50:46 BST

It must be the new page I activated it by using my finger pad.


Poster: John
Dated: Wednesday September 24 2003 - 17:29:19 BST

Not sure what you mean by 'new page'. We're talking about a contextual menu that pops up anywhere on the page that you do a right click.


Poster: Maz
Dated: Wednesday September 24 2003 - 22:38:54 BST

I don't see it then.


Poster: Hergio
Dated: Wednesday September 24 2003 - 22:49:10 BST

Might be your browser. Go to the homepage and wait for the page to completely finish loading, then RIGHT click on the page. Or do whatever it is you do usually to get the Context menu to show up (the menu you use to save images or view the source on a webpage). If you cant see it, then I guess its your browser.


Poster: John
Dated: Thursday September 25 2003 - 0:18:35 BST

We're workin' with an old Mac here, Dave. She might not have a 2-button mouse. That's why I suggested a Cmd-click, or possibly a Ctrl-click.


Poster: Maz
Dated: Thursday September 25 2003 - 5:28:53 BST

:) this is the world of drop and drag...

I managed to see it on windows 98 IE6.0, when I closed the box it wouldn't come up again. It won't work on Mac IE 5.1.7 would be nice if it did.

Let me know when you can drop and drag surround text or into a parent browser :lol: dreamerrr

maz


Poster: John
Dated: Thursday September 25 2003 - 14:55:49 BST

It could only be the fact you don't have a 2-button mouse, and the old OS and/or browser doesn't recognize a simulation. I have a 2-button on my G4 and it works as advertised.


Poster: Maz
Dated: Thursday September 25 2003 - 15:53:48 BST

It definately doesn't work on this system even with a three click finger pad on the key board. Its an old Mac/powerPC for translating pc disks.
maz


Poster: kevin3442
Dated: Saturday September 27 2003 - 1:29:27 BST

Hi All,

I had made a Milonic conext menu with version 3, 'cause I thought it'd be cool, but abandoned the idea when one of my colleagues complained that it would preclude the standard context menu, which many find useful. I didn't feel like putting in a toggle to enable/disable the custom menu, although in hindsight I suppose it wouldn't be too hard. I still haven't gotten to the production phase of our site using v5, but I do get a chance to dabble now and then, by way of preparation of course (my excuse for playing). And this is just the sort of dabbling I like :)

I imagine Andy's approach probably doesn't involve any special functions in the menu system itself, but is somewhat like most right-click customizations: you trap and handle a right click event; in this case, by opening a menu that's already defined in your menu_data.js file, but not linked to any showmenu call and not alwaysvisible to start.

It was easy to convert my v3 implementation to v5, because the menu system itself does the hard work (e.g., you can just use the built-in popup() function to open the menu at the cursor location). Here is a script that could get you started:

Code:
var mm5_contextMenuName = "contextMenu";

function mm5_showContextMenu()
{
  popup(mm5_contextMenuName, 1);
  return false; // disables the standard context menu;
}

function mm5_hideContextMenu()
{
  menuObj = gmobj("menu" + getMenuByName(mm5_contextMenuName));
  menuObj.style.visibility = "hidden";
}

document.oncontextmenu = mm5_showContextMenu;
document.body.onclick = mm5_hideContextMenu;

Copy the code into the top of your menu_data.js file, or put it in a separate .js file that you load into each page that you want to display context menus (the first way is easier in my book).

The gloabal variable at the top, mm5_contextMenuName, should be set to the name of the menu that you want to open when the user right clicks. That menu should be defined in your menu_data.js file, just as you would define any other submenu (but this one isn't opened by a showmenu call from any other menu).

That's it. When you right-click on the page, the menu will open at your cursor location (the popup() function in the menu system does all the work, including adjusting for collisions with window edges). If you left-click anywhere off the menu, the menu should close. Or, if you mouse over the menu, then out again, the menu should close. The latter behavior could be modified, so that the user had to click off of the menu to close it -- like the standard Windows context menu. You'd do this by setting alwaysvisible to on, but you'd have to do it programatically, at run time, rather than in the menu_data definition, so that the menu didn't appear automatically when the page first loads (it would actually be an easier tweak than it sounds!).

One catch... this code isn't written to work with ns4. But if anyone wants to make it work with ns4, and doesn't know how, give a holler and I'll make the necessary adjustments. Hope some of you find it useful.

Gearing up for menuing madness!...

Kevin


Poster: John
Dated: Saturday September 27 2003 - 6:37:21 BST

'Bout time you got back in here, bub! Where the heck have you been?

Thanks for the code snip.


Poster: kevin3442
Dated: Tuesday September 30 2003 - 0:27:11 BST

Hi John,

Been swamped with work... traveling the country teaching good guys devious ways to nab bad guys, then catching up on the work that piles up while I'm gone. Haven't had much chance to work with the new menus. But we just released our latest product upgrades, so a major website overhaul is imminent. I'll need to play... uh... research and experiment with the menus to prepare for that! Looks like you and Dave have the boards well covered. You two are doing an excellent job, along with a few of your regular participants. You're all due a big Thanks! This is still one of the best on-line communities I've ever come across. Keep it up, please, because I'll probably be hammering you with questions in due course! ;) (And probably chime in now and then to give back).

Keep up the excellent work!

Kevin


Poster: John
Dated: Tuesday September 30 2003 - 6:45:13 BST

Thanks very much for the kind words - most appreciated.

Keep your eye on the updates (not all are posted in a message). Andy has been pumping them out pretty fast. You will like this v5. More features than you can shake the proverbial stick at.

Play with it, and please jump in (as you have been) at any time. Your expertise is welcome, as always.