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

Yoshiki Ohshima yoshiki at squeakland.org
Sat Mar 3 18:39:08 PST 2007


  Hello, Young-Jin,

> 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?

  There are a quite a few different ways.

  #1:
   * For the "Button" from the supplies bin, get the halo for it.
   * There is a pale green/blue handle near the bottom right corner.
   * You'll get the scriptor that is invoked when you click it.  (You
     can programatically invoke the button's action by sending "fire"
     command in the "button" viewer category.

  #2:
   * For any object, you can make it a button.
   * Create a scriptor for an Etoys object.
   * Hold the mouse button for a second on the "script status" that is
     showing "Normal" by default.  You'll get a menu.
   * From the menu, choose "mouseDown" or "mouseUp".  The script will
     be executed when you do click on (or click on and release) the
     object.

-- Yoshiki


More information about the Squeakland mailing list