locked
Settings are being saved even on cancel? RRS feed

  • Question

  • Ok, I have this weird issue with my Gadget. If I make changes in the settings and select cancel instead of save, it still commits the changes?? How can I stop that from happening?
    Tuesday, July 13, 2010 2:28 PM

Answers

  • The point is showing to script that user have pressed button, Ok or Cancel
    System.Gadget.onSettingsClosing=onSetsClosing;
    function onSetsClosing(e)
    {
    	if(e.closeAction==e.Action.commit)
    	{
    		//pressed ok
    	}
    	else
    	{
    		//pressed cancel
    	}
    }
    

    So you have two ways:
    1. you can save settings when pressed ok, and don't save when pressed cancel
    2. you can save settings immediately and if cancel pressed, restore old settings.

    • Marked as answer by bebeTech Tuesday, July 20, 2010 12:34 PM
    Wednesday, July 14, 2010 11:25 AM

All replies

  • Settings are being saved when you are saving them. The buttons on the settings window do nothing. They only close the window.
    Tuesday, July 13, 2010 7:04 PM
  • Really? What's the point in MS putting those buttons there?
    Tuesday, July 13, 2010 10:37 PM
  • The point is showing to script that user have pressed button, Ok or Cancel
    System.Gadget.onSettingsClosing=onSetsClosing;
    function onSetsClosing(e)
    {
    	if(e.closeAction==e.Action.commit)
    	{
    		//pressed ok
    	}
    	else
    	{
    		//pressed cancel
    	}
    }
    

    So you have two ways:
    1. you can save settings when pressed ok, and don't save when pressed cancel
    2. you can save settings immediately and if cancel pressed, restore old settings.

    • Marked as answer by bebeTech Tuesday, July 20, 2010 12:34 PM
    Wednesday, July 14, 2010 11:25 AM
  • Worked perfectly, thanks
    Tuesday, July 20, 2010 12:34 PM