[lively-kernel] Three quick questions
rick.mcgeer at gmail.com
Mon May 26 03:29:55 CEST 2014
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...
More information about the lively-kernel