Right-click Context menu
- CyrixInstead
- Beginner
- Posts: 5
- Joined: Sat Sep 20, 2003 4:27 pm
- Location: Stoke-on-Trent
- Contact:
Right-click Context menu
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
I like it very much, and was wondering if anyone could tell me when it would become available to use/download.
~Cyrix
There are 10 types of people in the world: those who can read binary, and those who can't.
- CyrixInstead
- Beginner
- Posts: 5
- Joined: Sat Sep 20, 2003 4:27 pm
- Location: Stoke-on-Trent
- Contact:
- CyrixInstead
- Beginner
- Posts: 5
- Joined: Sat Sep 20, 2003 4:27 pm
- Location: Stoke-on-Trent
- Contact:
Just go to the main Milonic website i.e. http://milonic.com and right-click your mouse. Rather than the standard Windows context menu you get a cool Milonic one.
~Cyrix
~Cyrix
There are 10 types of people in the world: those who can read binary, and those who can't.
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.
Dave Hergert
Software Engineer
"Helping to make the menu better, one
at a time."
Software Engineer
"Helping to make the menu better, one

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:
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
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: Select all
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;
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
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
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!

Keep up the excellent work!
Kevin
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.
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.
John