[MWForum]Bobbing Buttons uploaded, plus more strategies

Wendy Petti mwforum@lists.mathcats.com
Thu, 9 Jan 2003 22:10:10 -0500


I've uploaded Jeff's and Jacques' "bobbing buttons" projects to the
attachments page:

http://www.mathcats.com/mwforum/attachments.html

I lightly edited both projects:  I made the correction Jeff told us
about on the third page of his project, and I removed the sound file
from the code in Jacques' project, for he had not attached it and it
caused an error message.

By the way, the MicroWorlds projects on the attachments page are all MW
Pro projects.  If any of you have trouble opening MW Pro projects with
your version of MicroWorlds, please let me know offlist and I can resave
these as MicroWorlds 2.0_ projects (for PC) and add these extra versions
to the attachments page.

Jeff, thanks for your detailed explanation of how to design the graphics
to make buttons look as if they are depressed.  I confess that as far as
the procedures go, I favor Jacques', which is certainly much simpler!

I have two more ways of dealing with the illusion of depressed buttons.
One method for making a button look as if it remains depressed until the
user clicks on it again is to have two turtles on top of each other,
each wearing one of the two button shapes.  Each one is programmed, like
this:

t1's instruction is:
t1, ht  t2, st procedure#1

t2's instruction is:
t2, ht  t1, st procedure#2 (if needed)

This method means that you have more turtles on the page, though, and
you have to take care to line them up properly.

The alternative is to use one turtle and code such as this:

t1, ifelse shape = "shape1 [setsh "shape2]  [setsh "shape1]  procedure#1

If you want the button to stay depressed as long as the procedure is
running and then return to its original shape, you could write this
code:

t1, ifelse shape = "shape1 [setsh "shape2] [setsh "shape1]
procedure#1
setsh "shape1

Wendy Petti