[Project_owners] Preferences in Mozilla
neil at parkwaycc.co.uk
Sun Dec 28 19:57:10 EST 2003
Jaap A. Haitsma wrote:
> 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
> 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
> over there 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.
OK, here's a brief run-down:
1. The main pref window opens. It initializes a few globals, such as
top.hPrefWindow, and then loads a pref panel.
2. When loading a pref panel the widgets are initialized from system
preferences (using the prefstring attribute).
3. When the user selects a different panel the current values are
saved in the data manager.
4. When the user selects a previously displayed panel then the
widgets are restored from the data manager, rather than the system
5. When the user accepts the dialog then all the OK handlers are
called, then the system preferences are updated. At this point the
data manager should have the current widget values, but that
wasn't true for old versions of mozilla.
More information about the Project_owners