Q: How to create a command button

Aaron J Reichow reic0024 at d.umn.edu
Thu Mar 14 07:16:10 UTC 2002


On 14 Mar 2002, Martin Drautzburg wrote:

> What is the easiest way to create a button, that evaluates a smalltalk
> expression.

It's easy!

1. Open the World Menu
2. Select "objects (o) ..."
3. Click on the "Scripting" category
4. Drag a Button (they're yellow, labeled "Press me") to the background.
5. Cmd/Alt-Click on the new button to bring up the Morphic Halo
6. Click on the little eye icon, which brings up a Viewer
7. In the new Viewer flap, there are some tear-off scripts.  Change the
category on one of them to "scripts" from "basic."
8. Drag the bar in the "scripts" category to the world background.  It
will say something like "Button script1" on it.
9. Click the check-box that is to the left of the button labeled "Button"
and the right of the yellow-exclamation point and brown-o.
10. In the new text pane below, enter the code that you want executed when
the button is clicked.
11. Two spaces right of the red-X button, click the button labeled
"normal," and select the "mouseUp" event from the popup menu.

12. Click the brown-O on the script you just created.  It will remove it
from the view, but keep it connected to the button.
13. Click the brown-O on the Viewer flap that's on the upper-right of the
flap.  It will remove the flap from view, but keep your scripts connected
to the button.  You can bring it up again using steps 5-6 if you'd like to
make changes to the script or add a new one.
14. Have fun!

Seems like a lot of steps, but it's really quite easy to do, just not
explain without pictures. :)

Regards,
Aaron

  Aaron Reichow  ::  UMD ACM Pres  ::  http://www.d.umn.edu/~reic0024/
  "civilization is a limitless multiplication of
                unnecessary necessities."                :: mark twain





More information about the Squeak-dev mailing list