3.2.0

Right Click Context Menu in Firefox

Hello,

I've been using the code found here: http://www.activewidgets.com/javascript.forum.12947.7/how-to-properly-set-oncontextmenu.html to get right click context menus to work. So far they seem to work fine in IE, but not in Firefox. Firefox seems to require a double right click action to pop the browsers context menu within the grid, but it doesnt display the menu that I made. IE will display both on top of each other. I have some code to stop the browsers context menu, but I have commented it out for the time being so it is not a factor in the problem.

I'm also trying to do the same thing using a list box. It works the same, but one thing I noticed is that with a grid the row is selected when using the right mouse button as well. When right clicking inside the list box the row is not selected. Is there any way to select the row in a listbox on a right click event?

If anyone has any insight into these problems please let me know.

Thanks.
Aaron
December 2,
Its funny you should ask. Just yesterday I was trawling through FF's add-ons at the Mozilla site to see what other developer tools were useful.

I found quite a few that changed context menus. However, I suspect there might be something special about FF's context menus. I'm not entirely sure though.

Anyway, here are a few links to the add-ons that change the menus. Perhaps you can glean something from them -

https://addons.mozilla.org/en-US/firefox/addon/1931
https://addons.mozilla.org/en-US/firefox/addon/6664
https://addons.mozilla.org/en-US/firefox/addon/37
https://addons.mozilla.org/en-US/firefox/addon/5964
https://addons.mozilla.org/en-US/firefox/addon/1601

There are plenty more if you want to do a search. Most also have home pages. They might be worth a visit.
Anthony
December 2,
Anthony,

Thanks for your help here, but I do not see how the links you provided or the suggestion of using a Firefox Addon would help me eliminate the need for the double right click issue. This is only only necessary inside the AW Grid.

If you take a look at the link I provided in my original post, the idea is to pop a custom formated HTML box when the right click event occurs. I do not want to add to the browsers menu, but replace it entirely.

As I said, this works great in IE using the javascript that Alex gave in that same link. For some reason Firefox does not work the same. Why? Is it possible? How?

Thanks.
Aaron
December 3,
No, I had an expectation that there might be a useful note or two left by a developer of one of the add-ons.

There is an FF add-on for event tracking which might help you figure out what's going wrong. I don't think the AW code is doing anything odd with the events.

Failing that, try searching here https://developer.mozilla.org/en/JavaScript

This would probably be the most useful page http://www.w3.org/TR/DOM-Level-3-Events/events.html#Events-flow
Anthony
December 3,
Anthony,

Any idea on how to make a right click event select the row in a list box giving it the same functionality as a left click?

Thanks,
Aaron
December 3,
Anthony,

Nevermind that last coment. I took a step back, and comented out the context menu code I'm playing with. Turns out a list box already does perform the same selection action on both a left and right click.

Thanks again,
Aaron
December 3,
Ok, scratch that...I'm in browser compatability hell now. The code below, in Firefox, will select a row on a right and left click. In Internet Explorer, it will only select the row with a left click.
var lstFiles= new AW.UI.List;
lstFiles.setId("lstFiles");
lstFiles.setItemText(function(i){return arrayFiles[i][0]});
lstFiles.setItemCount(arrayFiles.length);
lstFiles.refresh();

Aaron
December 3,
As everyone eventually discovers, if there's a problem its invariably IE's fault.

You might find some information here -
http://www.quirksmode.org/index.html
especially here -
http://www.quirksmode.org/js/events_mouse.html

This is also a very entertaining read -
http://www.howtocreate.co.uk/wrongWithIE/
Anthony
December 4,
obj.onItemMouseUp = function(event, index){
if (event.button == 2 ){
var x = obj.getSelectedItems();
x.lenght>0?x.push([index]):x=[index];
obj.setSelectedItems(x);
obj.refresh();
}
}
December 4,

This topic is archived.

See also:


Back to support forum