[Project_owners] Context menu

Matthew Waymost waymost at gmail.com
Wed Feb 1 07:41:50 EST 2006


The best way to do this is to use the showItem method of gContextMenu in
browser.js. Register a method to the onpopupshowing event, and call the
method with two args: the id of the menuitem and the boolean to determine
whether or not to show it. In your case, something like

gContextMenu.showItem
('foxgame-config-menu',isOGameDomain(window._content.document.location.href));

This is exactly how Fx controls what context menuitems you see when you
right click in the content area, and I've never had a problem with using it.

HTH, Matt

On 2/1/06, Ramiro Aparicio <frisco82 at gmail.com> wrote:
>
> It seems to work now:
>
> <popup id="contentAreaContextMenu">
> <menuitem id="foxgame-config-menu" label="&foxgame.menu.configure;"
> oncommand="configureFoxGame();" hidden="true"/>
> </popup>
>
> And:
>
> window.addEventListener("popupshowing", foxgame_initPopupMenu, true);
>
> For some strange reason if I do not set the hidden attribute in the xul
> file, the option is only shown in the correct web after you open the
> contextmenu in a web where it should not be shown.
>
> I hope ther will be no more problems with this becouse that little thing
> seems to disappear from time to time.
>
> On 2/1/06, Neil < neil at parkwaycc.co.uk> wrote:
> >
> > Didier Ernotte wrote:
> >
> > >object.setAttribute("collapsed", boolean) instead.
> > >
> > >
> > That's definitely wrong. Menus should always be hidden, never collapsed.
> >
> > Ramiro Aparicio wrote:
> >
> > ><menuitem id="foxgame-config-menu" label="&foxgame.menu.configure;"
> > onpopupshowing="foxgame_initPopupMenu(event);"
> > >
> > >
> > <menuitem>s don't get popupshowing events. As this is an overlay, you
> > need to add a popupshowing event listener to the content area context
> > menu.
> > _______________________________________________
> > Project_owners mailing list
> > Project_owners at mozdev.org
> > http://mozdev.org/mailman/listinfo/project_owners
> >
>
>
>
> --
> Hasta Otra
>
> Ramiro Aparicio
>
> ---------------------------------------------------------------------------------
>
> Webmaster de http://gs151.tk y http://www.climaxsl.es
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20060201/1dc29e65/attachment.htm


More information about the Project_owners mailing list