[lively-kernel] How to add a property to a morph visually

Roeder, Marko Marko.Roeder at student.hpi.uni-potsdam.de
Sat Feb 11 14:18:00 CET 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hpi.uni-potsdam.de/archive/lively-kernel/attachments/20120211/2023a690/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4759 bytes
Desc: not available
URL: <http://lists.hpi.uni-potsdam.de/archive/lively-kernel/attachments/20120211/2023a690/attachment.bin>


More information about the lively-kernel mailing list