[Squeakland] [Q] E-Toy: How to hook a button to other object

Alan Kay alan.kay at squeakland.org
Sat Mar 3 19:48:41 PST 2007


Hi --

Actually, any script can produce a button to fire it, and also, any 
object in Etoys can serve as a button (including text objects).

1. Suppose you have a text object named Text that contains some text: 
'This is some text'.

Drag out Text's characters <- This is some text onto the desktop to 
make a script.

Do it again to make a second script. Name the first script "reset" 
and the second one "change".

Change the text in the "change" script.

These scripts can be tested by clicking on the (!).
A script will give you a button to fire it. Look at the menu item in 
a script
[]


and choose the item button to fire this script.

Do this for the other script. Both of these buttons can be relabeled.

Here is what this example looks like
[]


2. You can also use any object as a button. Get out a rectangle. Put 
an empty rectangle script on the desktop. Put the tiles:
Text's characters <- This is different text in this script. Now look 
at the normal menu and choose mouseUp.  This script will fire when 
you do mouseUp on the rectangle object.

[]


You can make a toggle by adding a variable to hold true or false, etc.

Cheers,

Alan

At 05:18 PM 3/3/2007, Young-Jin Lee wrote:








>Hi,
>
>I am a newbie and trying to learn how to develop educational material
>using E-Toy.
>I went through several E-toy project, but still need some helps.
>
>In the test program I was writing, I put a few text objects and a
>Button object from "Supplies" tab. My object was to change the text of
>one of the text objects when the Button is clicked.
>
>First, I opened a Viewer for the Button object to figure out what
>kinds of things I can do to this Button object. I expected to find a
>method that will be invoked when the button object is clicked. To my
>surprise, there is no such method.
>
>I was able to achieve the goal by (1) creating a script to change the
>text of one of the text objects and (2) creating "Button to fire to
>this script". But, I don't think this method is in sprite of Squeack,
>visual programming. I want to first create a button and make this
>button change the text of one of the text objects when this button is
>clicked, not the other way around. To me, this approach is in line of
>Squeak's philosophy.
>
>Can any one please explain what I have missed?
>
>Thanks in advance.
>
>Young-Jin
>_______________________________________________
>Squeakland mailing list
>Squeakland at squeakland.org
>http://squeakland.org/mailman/listinfo/squeakland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://squeakland.org/pipermail/squeakland/attachments/20070303/56b3d692/attachment-0001.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2e821110.jpg
Type: application/octet-stream
Size: 2045 bytes
Desc: not available
Url : http://squeakland.org/pipermail/squeakland/attachments/20070303/56b3d692/2e821110-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2e82113f.jpg
Type: application/octet-stream
Size: 66444 bytes
Desc: not available
Url : http://squeakland.org/pipermail/squeakland/attachments/20070303/56b3d692/2e82113f-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2e8211ac.jpg
Type: application/octet-stream
Size: 30101 bytes
Desc: not available
Url : http://squeakland.org/pipermail/squeakland/attachments/20070303/56b3d692/2e8211ac-0001.obj


More information about the Squeakland mailing list