On Sat, Feb 11, 2012 at 7:18 AM, Roeder, Marko <[email protected]> wrote: > Hi Milan - > > Well I was not clear in my question .. "this.pages" must be a > deserialized Morph, from the xhtml page (or dragged from Parts Bin), > but, how would I create the "this.pages" list and add to the > ElProfesorOnLivelyKernel as a member, if I was to create the Profesor > from scratch … > > > To make it obvious that this attribute has been added to the > Part/rectangle/... , we sometimes added a script called reset() via the > ObjectExplorer that simply adds/clears those attributes (you might have to > look at some Parts to find one that uses reset - but for example the > PartsBin (Tools -> PartsBinBrowser) does). > > So in your case it could be something like this: > > this.addScript(function reset() { > this.books = []; > }).tag([]); > > Additionally, having defined this script you will also get a menu item > "reset" (halo item (M)enu) that executes it. In case of the PartsBinBrowser > for example we use reset() to clear any state before publishing changes back > to the PartsBin. > > Best, > > - Marko
Marko: Perfect, this is a great convention - just the sort of thing I was looking for, as it makes it obvious there is a way for the Morph state to be (re)initialized and is found by the method search! I will be using that Thanks, milan _______________________________________________ lively-kernel mailing list [email protected] http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
