[newbie] Really Basic Morphic UI Question

Ned Konz ned at bike-nomad.com
Wed Feb 27 01:03:08 UTC 2002


On Tuesday 26 February 2002 07:11 am, Jim Barton wrote:

> Then I tried to do the same thing using only the morphic interfaces. 

Which morphic interfaces? You already tried the programmatic ones, but 
there's the EToys (tile scripting) or you could also do some simple plugging 
of behavior at the button level.

I'll guess EToys. I'll also assume you have 3.2, since I'm too lazy to find a 
3.1 to try this on. Don't know if it's changed much from 3.1 to 3.2.

> I couldn't figure it out.  I created a button and a text field, stuck a '0'
> in the text field, and tried to create a scriptlet that would increment the
> field value everytime I pressed the button.  

I don't know what kind of text field you were using. But let's assume it's a 
TextMorph. Grab one out of your Objects tool or flap.

Click the halos open, then choose the viewer button (the eyeball).

In the "basic" category there's a line that looks something like:

Text's numericValue           <- 3

Grab the arrow of that and drag onto the desktop. You now have a script that 
will make the numeric value 3. That's not what you want, so drag from the 
same line on the tile that says "numericValue". Drop it on top of the 3 in 
your new script.

You'll see an arrow to the right of numericValue in your script. Click it. It 
will expand to + 1.

You're done with the script. Click on the (!) button to make sure that it 
works. Good. Now to make it a button...

Click on "Text" in the top row of your script to see a menu. Choose "button 
to fire this script". Now you have a button that will increment the number. 
You can change the button's label with its menu.

You can then stick the text field and button into something if you want.

> I know this must be trivially simple to solve, right?  Can someone help
> before I'm forced to teach my daughter Java ;-) ???

Please don't do that. 

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com



More information about the Squeak-dev mailing list