Hi,

"to display it again when the application is relaunched"

This implies that you are saving and loading the pref settings data.  If
the user clicks the cancel button, you could reload the settings data
that is already saved.  For CRUD, it sometimes makes sense to edit a
copy of the persisted data.  That way, if the user cancels, just blow
away the copy.  If they save, send the edited copy to the server and
update the model with the returned object; or directly from the copy, if
you're not worried about sync issues and want faster user feedback.

-TH

--- In [email protected], "quantum_ohm" <[EMAIL PROTECTED]>
wrote:
>
> Hi Everybody,
>
> I have an "options" button which leads to a new sate "options_state"
> when it is clicked.
> In this new state, I have a checkbox and two buttons "cancel" and
"valid".
> I handle fine the "valid" button which gets the checkbox state and
> save it,
> to display it again when the application is relaunched.
>
> Now my problem is if I change my checkbox state, then change my mind,
> I can do "cancel", but
> I don't see how anymore after tried several ways of doin' it...
> Sorry for sounding kind of basic... :-(
>
> With a little help from my friends...
>
> Thx for the Light !
>
> here is the snippet of code:
>
> private function onOptions():void
> {
> this.currentState = "options_state";
> setOptions();
> }
>
> // to handle the prefs when app is launched
> private function setOptions():void
> {
> if ( Flags.flag_startAtLogin == 0 )
> {
> checkbox_options.selected = true;
> }
> checkbox_options.addEventListener( Event.CHANGE, checkOptions );
> }
>
> private function checkOptions( evt:Event ):void
> {
> if ( checkbox_options.selected == false )
> {
> flag.setFlag( 1 );
> checkbox_options.selected = false;
> //NativeApplication.nativeApplication.startAtLogin = false;
> } else
> {
> flag.setFlag( 0 );
> //NativeApplication.nativeApplication.startAtLogin = true;
> }
> }
>
> private function onValider():void
> {
> savePreferences.createXMLData();
> savePreferences.writeXMLData();
> this.currentState = "";
> }
>
> private function onAnnuler():void
> {
> this.currentState = "";
> }
>


Reply via email to