I have a strange problem with 'showPopup'. This is what I do:
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.
deng wrote: >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.
>I have a strange problem with 'showPopup'. This is what I do: >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?
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.
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.
> Thank you.
This is a bug that is currently scheduled to be fixed for 1.9
>>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.