Help getting started with preferences - Mozilla

This is a discussion on Help getting started with preferences - Mozilla ; Hi, I am starting with building my first extension but could'nt get through a simple scenario.I have an options button that presents a XUL window with a few input parameters that he/she can input.I save them to the preferences. Here ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Help getting started with preferences

  1. Help getting started with preferences

    Hi,

    I am starting with building my first extension but could'nt get
    through a simple scenario.I have an options button that presents a XUL
    window with a few input parameters that he/she can input.I save them
    to the preferences.
    Here is the file that saves the preference:

    removethis.js

    pref("extensions.removethis.basekey", "");
    pref("extensions.removethis.keychar", "Q");
    // See http://kb.mozillazine.org/Localize_e...n_descriptions
    pref(”extensions.removethis@seige.description”, “chrome://removethis/
    locale/removethis.properties”);

    Now,I just want to alert the value of one preference when the
    extension is executed. I load the preference manager and then try to
    access my preference.Here is the code for execution:

    overlay.js

    onMenuItemCommand: function(e) {
    var prefs = Components.classes["@mozilla.org/preferences-service;
    1"] .getService(Components.interfaces.nsIPrefBranch);
    var basekeyvalue = prefs.getCharPref(”extensions.removethis.basekey”) ;

    I am debugging using Venkman and my code exits on executing the
    following line :

    var basekeyvalue = prefs.getCharPref("extensions.removethis.basekey");

    I would be glad if I could get some pointers.

  2. Re: Help getting started with preferences

    On Jun 29, 10:28*am, Seige wrote:
    > Hi,
    >
    > I am starting with building my first extension but could'nt get
    > through a simple scenario.I have an options button that presents a XUL
    > window with a few input parameters that he/she can input.I save them
    > to the preferences.
    > Here is the file that saves the preference:
    >
    > removethis.js
    >
    > pref("extensions.removethis.basekey", "");
    > pref("extensions.removethis.keychar", "Q");
    > // Seehttp://kb.mozillazine.org/Localize_extension_descriptions
    > pref(”extensions.removet...@seige.description”, “chrome://removethis/
    > locale/removethis.properties”);
    >
    > Now,I just want to alert the value of one preference when the
    > extension is executed. I load the preference manager and then try to
    > access my preference.Here is the code for execution:
    >
    > overlay.js
    >
    > onMenuItemCommand: function(e) {
    > var prefs = Components.classes["@mozilla.org/preferences-service;
    > 1"] .getService(Components.interfaces.nsIPrefBranch);
    > var basekeyvalue = prefs.getCharPref(”extensions.removethis.basekey”) ;
    >
    > I am debugging using Venkman and my code exits on executing the
    > following line :
    >
    > var basekeyvalue = prefs.getCharPref("extensions.removethis.basekey");
    >
    > I would be glad if I could get some pointers.


    can anyone help please?

+ Reply to Thread