[Squeakland] 2 questions - embedding text box and keystroke
milan.zimmermann at sympatico.ca
Sat Dec 11 20:45:53 PST 2004
Please see inline:
On December 9, 2004 04:05 pm, Arvind S. Grover wrote:
> I have tried posting these in the forum, but it seems that no one is
> really looking there, so I am going to post them here:
> 1) i am trying to embed a text box into a painted object so that it
> looks and acts like one object. basically i want to be able to pick up
> and move the item as one, but still be able to script the textbox's
> behavior. i am have tried the embed action, but it only says i can embed
> into "world." any ideas?
I assume your painted object has just lines or lots of "empty" areas - the
problem is that you have to position your text box "just right" over some
painted area of the painted object for the "embed into PaintedObject" to
appear in the text box's menu. I had the same problem but it can be done with
a bit of trying...
> 2) What is the best way to "listen" for keystrokes? Example: the user
> hits the left arrow key and the object moves to the left.
I don;t think there is a "default" eToy way to ask a Morph to respond to
keystrokes - someone on this list (I forgot who it was, appologize for it)
sent me the attached. If you install it, you will see in the "viewer" under
"tests" "MyObjects 's key hit a". You can put it in a scropt, but you have to
textually edit it to allow control by keys. Som,ething like:
(self wasCharacterHit: Character arrowUp)
ifTrue: [self setHeading: 0.0].
(self wasCharacterHit: Character arrowRight)
ifTrue: [self setHeading: 90.0].
(self wasCharacterHit: Character arrowDown)
ifTrue: [self setHeading: 180.0].
(self wasCharacterHit: Character arrowLeft)
ifTrue: [self setHeading: 270.0].
Hope this is what you were asking for - let me know if you need help with
> Squeakland mailing list
> Squeakland at squeakland.org
More information about the Squeakland