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

Fabian Bornhofen fbornhofen at googlemail.com
Sat Feb 11 08:32:36 CET 2012

Hi Milan -

you can add properties to a Morph in the same way you can add
properties to any JavaScript object:
aMorph.foo = 'Bar';
would set aMorph's 'foo' property to 'Bar', no matter if it existed
before or not.

In the Object Editor window, 'this' is bound to the morph you're
editing, so you can just open the OE on a morph and eval something
like this.newProperty = newValue. Properties added this way will also
be serialized with the morph.

So I guess there is two things to adding properties to morphs:
(a) it's actually terribly easy if you know how to do it
(b) it's incredibly hard if you don't
It's also hard to tell where and when (class creation? by the user?) a
property was added and which properties are actually crucial for the
code in class Morph to work and which are user-defined add-ons. That's
something to think about.


On Fri, Feb 10, 2012 at 11:10 PM, Milan Zimmermann
<milan.zimmermann at gmail.com> wrote:
> On Sat, Feb 11, 2012 at 12:49 AM, Milan Zimmermann
> <milan.zimmermann at gmail.com> wrote:
>> On Fri, Feb 10, 2012 at 11:52 PM, Milan Zimmermann
>> <milan.zimmermann at gmail.com> wrote:
>>> Hi:
>>> I am trying to build a quick extremely simple library management application.
>>> Something I am missing that is likely due to my lack of Lively skills:
>>> I create a Morph and call it "Library Application" in the World. I'd
>>> like to add to it a member called "books" which would be a list. Is
>>> there a way to do it visually, apart from creating the Library
>>> Application as a Morph extension with the books member?
>>> (I am afraid following this I have more - naive - questions. Sorry for
>>> the noise...)
>>> Thanks
>>> milan
>> Hmm, now I have formulated my question at another level. I am going
>> through the Professors introduction. There is a Morph named
>> ElProfesorOnLivelyKernel. It has a member "this.pages" - I search the
>> code but cannot figure out where is "this.pages" instantiated, and how
>> can I see it is a member of ElProfesorOnLivelyKernel, apart from
>> seeing it in the Editor code... I appreciate any hints however obvious
>> :)
>> Thanks,
>> 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 ... sorry about keep expanding this, will stop ...
> Thanks,
> milan
> _______________________________________________
> lively-kernel mailing list
> lively-kernel at hpi.uni-potsdam.de
> http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel

More information about the lively-kernel mailing list