1.- open a 'toolbaritem' by clicking on a button at Firefox toolbar
2.- one of the menuitem that appear has a 'oncontextmenu' event handler
that shows a popup menu using showPopup
After the popup shows if I click anywhere on firefox the popup and the
toolbaritem should be dismissed, instead of that they remain on the
screen and I have to close using the ESC key.
This is the code I use to open the popup:
onBookmarkContextMenu: function(event, id) {
document.getElementById("bookmarkPopup").showPopup(document.getElementById(id),
event.screenX + 6, event.screenY + 6, "popup", "bottomright",
"bottomright");
},
I add the eventhandler after creating the menuitem:
setAttribute("oncontextmenu", "dengGB.onBookmarkContextMenu(event, '" +
id + "'); return false;");
Any ideas?
>1.- open a 'toolbaritem' by clicking on a button at Firefox toolbar
>2.- one of the menuitem that appear has a 'oncontextmenu' event handler that shows a popup menu using showPopup
>
>
What's wrong with setting the contextmenu="bookmarkPopup" attribute? But
IIRC you need to use the "context" parameter, rather than the "popup"
parameter, for a context menu.
--
Warning: May contain traces of nuts.
>After the popup shows if I click anywhere on firefox the popup and the
>toolbaritem should be dismissed, instead of that they remain on the
>screen and I have to close using the ESC key.
>This is the code I use to open the popup:
>onBookmarkContextMenu: function(event, id) {
>document.getElementById("bookmarkPopup").showPopup(document.getElementById(id),
> event.screenX + 6, event.screenY + >6, "popup", "bottomright",
>"bottomright");
>},
>I add the eventhandler after creating the menuitem:
>setAttribute("oncontextmenu", "dengGB.onBookmarkContextMenu(event, '" +
>id + "'); return false;");
>Any ideas?
Maybe you can use hidePopup() function
_________________________________________________________________
享用世界上最大的电子邮件系统— MSN Hotmail。 http://www.hotmail.com
I change the line:
setAttribute("oncontextmenu", "dengGB.onBookmarkContextMenu(event)");
with your suggestion:
setAttribute("oncontextmenu", "bookmarkPopup");
where 'bookmarkPopup' is the name of XUL declareated popup item.
Nothing happens. I tried too with:
setAttribute("oncontextmenu",
document.getElementById("bookmarkPopup"));
Nothing happens either. Keep in mind that I create the menuitem
dynamically in a javascript file.
> IIRC you need to use the "context" parameter, rather than the "popup"
I tried the "context" and "tooltip" flags on showPopup: same effect.
Thank you for your replay.
hidePopup is my last option. I don't understand why as a programmer I
have to take care to close a popup. I rather think I am doing something
wrong.
Thank you.
Sorry Neil, I saw the error. I tried what you said:
setAttribute("context", "bookmarkPopup");
and yes the popup shows but the result is the same: the menuitem from
where the popup comes, stays in the screen, and a click on firefox will
not dismiss it. I am gonna have to use hidePopup.
The best solution (the only I can find now), was DongDong idea: use
hidePopup.
Thank you again.
This is a bug that is currently scheduled to be fixed for 1.9
/ Neil
>deng wrote:
>
>
>>>Maybe you can use hidePopup() function
>>>
>>>
>>hidePopup is my last option. I don't understand why as a programmer I have to take care to close a popup. I rather think I am doing something wrong.
>>
>>
>This is a bug that is currently scheduled to be fixed for 1.9
>
>
I'm sorry that I didn't understand what the problem is; as far as I know
you can expand a bookmark folder on the personal toolbar and invoke a
context menu on one of its items without any apparent difficulty.