Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with showPopup

16 views
Skip to first unread message

deng

unread,
Nov 21, 2006, 8:53:31 AM11/21/06
to
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?

Neil

unread,
Nov 21, 2006, 7:45:33 PM11/21/06
to
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.

--
Warning: May contain traces of nuts.

Deng DongDong

unread,
Nov 21, 2006, 8:00:03 PM11/21/06
to dev-te...@lists.mozilla.org
>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?

Maybe you can use hidePopup() function

_________________________________________________________________
享用世界上最大的电子邮件系统— MSN Hotmail。 http://www.hotmail.com

deng

unread,
Nov 22, 2006, 10:06:18 AM11/22/06
to

Neil wrote:
> What's wrong with setting the contextmenu="bookmarkPopup" attribute?

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.

deng

unread,
Nov 22, 2006, 10:09:01 AM11/22/06
to
> 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.

deng

unread,
Nov 22, 2006, 10:18:33 AM11/22/06
to
> setAttribute("oncontextmenu", "bookmarkPopup");

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

unread,
Nov 22, 2006, 10:42:30 AM11/22/06
to
> Maybe you can use hidePopup() function

The best solution (the only I can find now), was DongDong idea: use
hidePopup.

Thank you again.

Neil Deakin

unread,
Nov 22, 2006, 11:00:15 AM11/22/06
to

This is a bug that is currently scheduled to be fixed for 1.9

/ Neil

Neil

unread,
Nov 22, 2006, 7:13:19 PM11/22/06
to
Neil Deakin wrote:

>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.

0 new messages