[lively-kernel] Three quick questions

Rick McGeer rick.mcgeer at gmail.com
Tue May 27 03:22:45 CEST 2014


Tim,
Many thanks.

-- Rick


On Mon, May 26, 2014 at 12:39 AM, <timfelgentreff at gmail.com> wrote:

>  Only just realized that Robert put a module in for 3 some time ago:
> https://github.com/LivelyKernel/LivelyKernel/commit/31870348b9c1b5450294b4658fef142c44fd1988
>
> It seems you should be able to just use
> lively.morphic.Preview.renderMorphToNewImage(morph, {}, callback)
>
>
> *From:* Tim Felgentreff <timfelgentreff at gmail.com>
> *Sent:* ‎Monday‎, ‎May‎ ‎26‎, ‎2014 ‎9‎:‎27‎ ‎AM
> *To:* Rick McGeer <rick.mcgeer at gmail.com>,
> lively-kernel at hpi.uni-potsdam.de
>
> Hi
>
> Re 1: I think the functions on the world may just not be serialized
> usually, but it works for me if you do
>    $world.addScript(function onFocus(evt) {
>         alertOK("World focus")
>         if (!this.isFocusable()) { this.blur(); return };
>         lively.morphic.Morph.prototype._focusedMorph = this;
>     })
>
> Re 2: The Shortcuts documentation says you can add links with CMD+K
>
> Re 3: I did that once for PartsBin screenshots. This issue describes how
> it can be done: https://github.com/LivelyKernel/LivelyKernel/issues/248
>
> Hope that helps,
> Tim
>
> *From:* Rick McGeer <rick.mcgeer at gmail.com>
> *Sent:* ‎Monday‎, ‎May‎ ‎26‎, ‎2014 ‎3‎:‎29‎ ‎AM
> *To:* lively-kernel at hpi.uni-potsdam.de
>
>
>    1. I'm having this odd behavior where $world.onFocus() is getting
>    overwritten on a $world.saveWorld().  Specifically, I set $world.onFocus to
>    a function which assigns the focus to a specific morph on the page
>    ($world.get('2048Board').get('Board').focus()).  This works fine, and when
>    I click away from the tab and back to it the focus is assigned correctly.
>     I can also look at $world.onFocus and see it's the correct function.
>     However, after I do a $world.saveWorld() and then reload the page, I get
>    the default $world.onFocus method, not the one I wrote.  Is this a bug, or
>    is there something I'm doing wrong?
>    2. Is there a preferred way of doing hyperlinks?   I can think of at
>    least two, and I'm sure that there are more.  The two I've thought of are
>    to use an HTMLWrapperMorph, and to attach an onMouseDown event, but I
>    guarantee there's a third way, and the third way is better.  I know there's
>    a third way because I've looked at the source for the welcome page, and the
>    hyperlinks are in text morphs, which turn into <span>s in the HTML source,
>    and the links themselves are <uri> tags in the span.  My problem is I don't
>    know how to create this using Morphic (it may be I am just slow today).
>     The hell of it is, I knew how to do it once, because I put the link to
>    Lively Cheat Sheet on the Welcome page (I wanted to put the link to
>    Robert's marvelous Lively 101 page there, too, but more important I wanted
>    to figure out how to do this....sorry for the dumb question)
>    3. Is there a way to flatten a morph or (equivalently) generate an
>    image file for a morph?  The specific case I'm thinking of is where one
>    builds up a complex image from lots of submorphs, but once done doesn't
>    want to manipulate the submorphs anymore...just bake the thing in place.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hpi.uni-potsdam.de/archive/lively-kernel/attachments/20140526/3210ba75/attachment.html>


More information about the lively-kernel mailing list