user interface - Pattern for changing program options in a GUI -
i'm adding gui existing command line app. properties used app held in class(es) , i'm creating dialog binds options objects. however, if want cancel out of dialog have reset values of options objects, i'm running probs.
i take internal copy of option objects , use re-populate original object allow cancel/rollback seems cumbersome.
i can (somehow) implement undo function on each class - there pattern that?
i use gui controls standalone hold values , update options objects when dialog has been confirmed.
what's best practise?
you should consider creating new class used gui. guis have own needs.
make sure take care of multi thread issues if have more 1 thread accessing options object.
the design patterns address undo functionality called command , memento. think memento fit better on case.
take on question on so: design pattern undo engine.
following links of interest (and many more): http://www.coderanch.com/t/100676/patterns/memento-vs-command-pattern http://www.developer.com/design/article.php/3720566/working-with-design-patterns-memento.htm http://www.colourcoding.net/blog/archive/2009/07/23/reversibility-patterns-memento-and-command.aspx
Comments
Post a Comment