[Project_owners] Preferences in Mozilla

Jaap A. Haitsma jaap at haitsma.org
Sun Dec 28 20:22:39 EST 2003


HJ wrote:
> "Jaap A. Haitsma" <jaap at haitsma.org> wrote:
> 
>>>if you're overlaying the preftree etc, your panel needs to have an _elementIDs array for Seamonkey to save the prefs
>>>
>>>look at one of the existing panels
>>
>>Thanks!!
>>
>>In my own save function for Firebird I check if the values are legal. 
>>Can I do this also in Seamonkey??
>>
>>Do you maybe know a small extension which has the functionality I'm 
>>looking for? That way it will be even more easy for me.
>>
>>Cheers,
>>Jaap
> 
> 
> use onunload(); or look at this: 
> http://lxr.mozilla.org/seamonkey/source/xpfe/components/prefwindow/resources/content/pref-navigator.js#254
> 
Finally I have it more or less going using the code on the link above as 
an example (The way Firebird handles preferences is a huge improvement I 
have to say). I first had the code of Startup() init() and doOnOk() in 
my main .js file. This doesn't work because hPrefWindow does not exist 
in the main code. You have to make a seperate .js file which you include 
in the xul file which contains your preferences. (Luckily found this 
with google after hours of being flabbergasted why it didn't work :-( )

Now I still have the remaining problem that I want to verify the values 
the user typed. I thought I do this in doOnOK, but I discovered that the 
dialog data that you obtain like this:

var dictionarysearchData = prefWindow.wsm.dataManager 
 
.pageData["chrome://dictionarysearch/content/pref/pref-dictionarysearch.xul"]
                                          .dictionarysearchData;

is somehow still the data which was in the dialog when you opened it. 
After doOnOK somehow automagically the changed values get saved. Because 
  my main code picks the changed values up correctly.

Because I still have old values in the doOnOk() callback I can't test 
overthere if the changed values are correct. Furthermore I can't seem to 
stop the dialog from closing in doOnOk()

Actually if I leave out the whole doOnOK() the properties get saved 
correctly somehow.

Then I thought I use the onclose or ondialogaccept callback of my 
preference panel. But those callback do not get called.

Anybody out there who can help me out? Also an explanation on how these 
preferences work in Mozilla Seamonkey I would highly appreciate.

Thanks

Jaap


More information about the Project_owners mailing list