1 CLASS:: SimpleController
2 summary:: Controller according to the model-view-controller (M-V-C) paradigm
4 related:: Classes/Object
8 SimpleController can be used as a controller according to the model-view-controller (M-V-C) paradigm. It provides an
9 link::Class/IdentityDictionary:: of actions, which are called whenever the attached model sends a notification by
16 Creates a SimpleController instance with the model to be observed.
19 An object of any class
24 private:: init, update
29 Register an action, which is called when the model invokes changed(what, moreArgs).
38 Remove a registered action.
48 var controller, model, view;
51 controller = SimpleController(model);
52 controller.put(\value,
53 {|theChanger, what, moreArgs|
54 view.value_(theChanger.value);
57 view = Slider(Window("slider", Rect(100, 100, 330, 38)).front, Rect(5, 5, 320, 20));
58 view.onClose_{controller.remove};
60 // run a routine to change the model's value:
63 model.value_(1.0.rand.postln).changed(\value);