I ran into the same issue - I dealt with it in the onok event of
options.xml and the onoptionchanged event of main.xml by setting a
"changed" flag then matching on the event.propertyName property:
OPTIONS.JS
function onOk() {
if (fieldOne.value != options.getValue('optOne')) {
options.putValue('optOneChanged', true);
options.putValue('optOne', field.value);
}
...
MAIN.JS
function onOptionChanged() {
if (event.propertyName.match("optOne")) {
if (options.getValue('optOneChanged')) {
options.putValue('optOneChanged', false);
[do code...]
}
}
...
Geoff
On Tue, Oct 14, 2008 at 8:16 AM, philw
<[EMAIL PROTECTED]> wrote:
>
> I have an options dialog in which it's likely that the user will
> change more than one setting. I'm using the main.xml/ options.xml
> structure.
>
> I get an "onok" event in options.xml / referenced js file which I use
> to save the settings. No problem there.
>
> I need to refresh the parent main.xml if the user presses ok. I don't
> really care if the options have actually changed as a refresh is
> cheap, but it's essential if any of the options have changed.
>
> I can wire it up so the main.xml/opoptionchanged event fires. No
> problem there. If I change a single option, I get one ping there and
> everthing's good. The problem is that usually people change several
> parameters... in which case I get multiple events here, which are
> really a very bad idea.
>
> Obvious solution 1: use the "onok" even in the parent mail.xml. That
> doesn't fire, perhaps because it's been handled by the child
> options.xml. Question1: how to I get an event to bubble? Do I need to
> explicitly raise an event from the options file onok? Where's that in
> the API?
>
> Obvious solution 2: Programmatically assign the onoptionchanged event
> in the parent, and rip it off when it's called, only putting it back
> after the whole thing's been refreshed. Ok, anyone know how you remove
> an event handler? Assigning it to null doesn't do it... I can try
> guessing I suppose..... -=?
>
> Obvious solution 3: catch the "onok" event in the parent instead of
> the child, and then call back down to the child to tell it to do the
> saving. This I will try next although it seems kind of kludgy.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Desktop Developer Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Desktop-Developer?hl=en
-~----------~----~----~----~------~----~------~--~---