[lively-kernel] How to add a property to a morph visually
milan.zimmermann at gmail.com
Sat Feb 11 09:36:25 CET 2012
This is indeed easy once you described it :) [I assume by OE you mean
the Introspector/Explorer(?), because I did not find a way to do it
from Object Editor - I am only able to add scripts from the Object
>From the bottom panel of the Introspector/Explorer it works to add a
member just by doing this.books=; as you said, thanks.
I tried to add it that way from the introspector/Explorer before, but
now I see my focus must have been on another property like "_Position"
and the bottom pane of the Inspector operates on the focused field, so
the field was not added where I expected it - which again makes sense
once I know ... [So I thought the bottom Introspector pane did not
work ... I did my homework but slopily]
Perhaps one more question - is there a more visual way to add a
property .. I am thinking, if there was a way to have a List in the
Parts bin, I could drag it on my Morph and it would be added it as a
member ... I guess I am looking for a way to compose non-morph objects
visually into morphs or non-morphs in a way equivalent to how morphs
are composed by grabbing and dropping. But that is only an aside.
Thanks for your help
On Sat, Feb 11, 2012 at 1:32 AM, Fabian Bornhofen
<fbornhofen at googlemail.com> wrote:
> Hi Milan -
> you can add properties to a Morph in the same way you can add
> 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:
>>>> 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...)
>>> 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
>> 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 ...
>> lively-kernel mailing list
>> lively-kernel at hpi.uni-potsdam.de
More information about the lively-kernel