Making a pop-up menu reflect a preference, even the default value

Henri Sivonen <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpfe
Message-ID <CANXqsRK0Y=WskMTksGw3RHkix2F4u8OLM1-9+LQ2-Tr=4zc-hw@mail.gmail.com>
I'm trying to make a pop-up menu that reflects a preference.  One case
doesn't work though: When the menu is shown and the value of the
preference is at the default value, the  pop-up menu shows an empty
time instead of initializing to the default item being the one shown.

If the preference is set to a non-default value whether by the menu
itself previously or via about:config, the menu is properly
initialized to show the item that reflects the non-default preference
value.

What do I need to do to make the default case work?

The code I have looks like this:

      <preference id="intl.charset.fallback.override"
name="intl.charset.fallback.override" type="wstring"/>

...

        <menulist id="DefaultCharsetList"
preference="intl.charset.fallback.override">
          <menupopup>
            <menuitem label="&languages.customize.Fallback.auto;"
  value="auto"/>
            <menuitem label="&languages.customize.Fallback.arabic;"
  value="windows-1256"/>
            <menuitem label="&languages.customize.Fallback.baltic;"
  value="windows-1257"/>
            <menuitem label="&languages.customize.Fallback.ceiso;"
  value="ISO-8859-2"/>
            <menuitem label="&languages.customize.Fallback.cewindows;"
  value="windows-1250"/>
            <menuitem
label="&languages.customize.Fallback.simplified;"  value="gbk"/>
            <menuitem
label="&languages.customize.Fallback.traditional;" value="Big5"/>
            <menuitem label="&languages.customize.Fallback.cyrillic;"
  value="windows-1251"/>
            <menuitem label="&languages.customize.Fallback.greek;"
  value="ISO-8859-7"/>
            <menuitem label="&languages.customize.Fallback.hebrew;"
  value="windows-1255"/>
            <menuitem label="&languages.customize.Fallback.japanese;"
  value="Shift_JIS"/>
            <menuitem label="&languages.customize.Fallback.korean;"
  value="EUC-KR"/>
            <menuitem label="&languages.customize.Fallback.thai;"
  value="windows-874"/>
            <menuitem label="&languages.customize.Fallback.turkish;"
  value="windows-1254"/>
            <menuitem
label="&languages.customize.Fallback.vietnamese;"
value="windows-1258"/>
            <menuitem label="&languages.customize.Fallback.other;"
  value="windows-1252"/>
          </menupopup>
        </menulist>


-- 
Henri Sivonen
[email protected]
http://hsivonen.iki.fi/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.