What's very confusing about the inspector is that the area on the right is
editable. If properties on the right are not persistable, then the right
should probably not be editable. I think I understand better.

So to alter an instance or class of a morph, a user must enter code in the
bottom area of the inspector window? And then do what: accept changes?
evaluate as JavaScript?

On Tue, Feb 24, 2009 at 2:58 AM, Robert Krahn <
[email protected]> wrote:

> How do I attach a mouse handler to a morph?
>
>
> Open an inspector on a morph then, to attach a new submorph on every click
> e.g., type something like this:
>
> // make sure the Morph really wants the event
> this.handlesMouseDown = Functions.True;
> // overwrite my onMouseDown method
> this.onMouseDown = function (evt) {
> var localPoint = this.localize(evt.mousePoint);
> var new Morph = Morph.makeRectangle(localPoint.extent(pt(10,10)));
> this.addMorph(); // because we manually define a method
> }.bind(this);
>
> Other Mouse handler methods: onMouseMove, onMouseUp
>
>
> Most of the time I have no idea what can be edited in the inspector: for
> instance how would I edit [object Object]?.
>
>
> Multiple possibilities, assume x is an object
>
> - If you have an instance of a class and want to know its methods
> x.constructor.functionNames() // constructor is the klass
>
> - If you have an object (instance or normal JS object) try
> Object.keys(x);
> Object.values(x);
> for (var name in x) { console.log(name + ': ' + x[name]) }
>
> - If you want to look at the source code open the SystemBrowser
> In Core.js e.g. the fundamental parts of Morphic are defined.
> You can also hit loadAll. Then enter in a TextMorph 'onMouseDown', select
> it and hit alt+w. You will get a list of all occurrences of onMouseDown in
> the source code.
>
> Robert
>
_______________________________________________
General mailing list
[email protected]
http://livelykernel.sunlabs.com/mailman/listinfo/general

Reply via email to