MozillaZine

Problem for displaying menu of prefwindow

Talk about add-ons and extension development.
skuallpa
 
Posts: 26
Joined: September 2nd, 2009, 1:42 am
November 5th, 2009, 2:19 am

Post Posted November 5th, 2009, 2:19 am

Hello,

I have a problem for displaying the tab menu in a prefwindow

Here is my xul

Code: Select all
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://myextension/skin/myextension_settings.css"?>
<!DOCTYPE overlay SYSTEM "chrome://myextension/locale/settings.dtd">
<prefwindow   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  id="myextensionPrefs"
   title="Preferences"
   buttons="accept,cancel,help"
   ondialoghelp=""
   persist="screenX screenY">
   <prefpane
      id="myextensionsPrefPaneGUI"
      label="Interface"
      helpTopic="interface">
      <preferences>
         <preference id="hideToolbarButton" name="extensions.myextension.hideToolbarButton" type="bool"/>
         <preference id="hideStatusbarIcon" name="extensions.myextension.hideStatusbarIcon" type="bool"/>
         <preference id="hideToolbar" name="extensions.myextension.hideToolbar" type="bool"/>
         <preference id="hideToolsMenu" name="extensions.myextension.hideToolsMenu" type="bool"/>
      </preferences>
      <vbox>
         <groupbox>
            <caption label="View"/>
            <checkbox label="Hide toolbar button" preference="hideToolbarButton"/>
            <checkbox label="Hide status bar icon" preference="hideStatusbarIcon"/>
            <checkbox label="Hide toolbar" preference="hideToolbar"/>
            <checkbox label="Hide Entry in tools menu" preference="hideToolsMenu"/>
         </groupbox>
      </vbox>
   </prefpane>
</prefwindow>


myextension_settings.css
Code: Select all
@import url(chrome://global/skin/);
#myextensionPrefsradio[pane] {
   list-style-image: url("chrome://browser/skin/preferences/Options.png");
}
#myextensionPrefsradio[pane="myextensionsPrefPaneGUI"] {
   -moz-image-region: rect(0px, 64px, 32px, 32px);
}


In the image below, at the left, this is what I obtain, at the right what I would like to obtain. But why is this icon not displayed?

Image

Do I need to do another thing? to make this "tab menu" appear?

Thanks in advance for your help

ake79
 
Posts: 661
Joined: February 17th, 2007, 6:05 am
November 5th, 2009, 8:14 am

Post Posted November 5th, 2009, 8:14 am

I tried just your xul in xul editor. Works fine.

css: "#myextensionPrefsradio"? or maybe "#myextensionPrefs radio"?
Save File to - Save files to user-defined folders and their sub-folders straight from context menu
ThumbsDown - Bulk image downloader

Philip Chee

User avatar
 
Posts: 4300
Joined: March 1st, 2005, 3:03 pm
November 5th, 2009, 9:32 am

Post Posted November 5th, 2009, 9:32 am

How are you launching your pref window? from the openDialog() call you need to set one of the features to "toolbar=yes", or just put "chrome,all" in the features parameter.

Phil

skuallpa
 
Posts: 26
Joined: September 2nd, 2009, 1:42 am
November 6th, 2009, 12:40 am

Post Posted November 6th, 2009, 12:40 am

Thanks for your answers.

I tried just your xul in xul editor. Works fine.


Yes, for me also, if I put the code in the xul editor, it works fine also exept that the image of the interface is not displayed, but the menu yes. I have also noticed that if I click in "open preview in new window" in the xul editor, the tab menu is no more displayed. I don't understand why...

I was launching the pref window with :

Code: Select all
window.openDialog("chrome://myextension/content/myextension_settings.xul", "", "centerscreen");


So I tried with

Code: Select all
window.openDialog(
         "chrome://myextension/content/myextension_settings.xul",
         '',
         'chrome=yes,resizable=yes,toolbar=yes,centerscreen=yes,modal=no,dependent=no,dialog=no'
      );


But the menu is still not displayed...

ake79
 
Posts: 661
Joined: February 17th, 2007, 6:05 am
November 6th, 2009, 9:33 am

Post Posted November 6th, 2009, 9:33 am

Oh, so you are opening prefwindow using js. Does it work if you open it normally? Tools > Addons > ...

Anyway, if you are going do something that browser already does, you should look examples from there. Use Dom Inspector and http://mxr.mozilla.org/.

http://mxr.mozilla.org/mozilla1.9.1/sou ... ns.js#2588
http://mxr.mozilla.org/mozilla1.9.1/sou ... lay.js#405
Save File to - Save files to user-defined folders and their sub-folders straight from context menu
ThumbsDown - Bulk image downloader

skuallpa
 
Posts: 26
Joined: September 2nd, 2009, 1:42 am
November 9th, 2009, 4:52 am

Post Posted November 9th, 2009, 4:52 am

Hello ake79,

Oh, so you are opening prefwindow using js. Does it work if you open it normally? Tools > Addons > ...


No the menu is still not displayed. I have take a look at the open preference function in http://mxr.mozilla.org/mozilla1.9.1/source/browser/base/content/utilityOverlay.js#405
and rewrite my open prefwindow function like that:

Code: Select all
window.openDialog("chrome://myextension/content/myextension_settings.xul", "Preferences", "chrome,titlebar,toolbar,centerscreen,dialog=no");


But the menu is still not displayed. There must be something wrong in the xul file.

skuallpa
 
Posts: 26
Joined: September 2nd, 2009, 1:42 am
November 9th, 2009, 5:06 am

Post Posted November 9th, 2009, 5:06 am

Ok, I have finally seen what is the problem.

The menu is not displayed if you have only one prefpane, what was my case. So I have created a second empty pane and set the css property display:none of the second pane image in the css.

Code: Select all
radio[pane="secondpane"]{
   -moz-image-region: rect(0px, 32px, 32px, 0px);
   display:none;
}


Thanks for your help

Return to Extension Development


Who is online

Users browsing this forum: Exabot [Bot] and 6 guests