[comp.sys.mac.hypercard] Multi-function Button

rgoldstone@OAVAX.CSUCHICO.EDU (Robin Goldstone) (02/05/91)

I think someone asked a question like this recently, but naturally I wasn't
paying attention since it didn't apply to *me* ...

I have a button that is used to control a counter.  Every time you click
the button, the value of the counter is incremented by one.  I would also
like to have a way for the same button to decrement the counter.  Either
option-click or command-click or control-click.  Can my button script check
to see if one of these keys was held down when the mouse was clicked?  

***********************************************************************
Robin Goldstone, California State University, Chico  Computing Services
rgoldstone@oavax.csuchico.edu

Ken.Knight@f421.n109.z1.fidonet.org (Ken Knight) (02/06/91)

rgoldstone@OAVAX.CSUCHICO.EDU (Robin Goldstone) asks:
>I have a button that is used to control a counter.  Every time you
>click
>the button, the value of the counter is incremented by one.  I would
>also
>like to have a way for the same button to decrement the counter.
>Either
>option-click or command-click or control-click.  Can my button script
>check to see if one of these keys was held down when the mouse was
>clicked?
 
Yes, you can use the various functions such as optionKey, commandKey,
and controlKey which all return either "up" or "down" within say an
if..then statement and then act accordingly. Thus:
on mouseup
  if the optionKey is down then
    decrement counter
   else
    increment counter
end mouseup
 
Internet: ken.knight@f421.n109.z1.fidonet.org    America Online:
KenKnight
            "Goodness me; could this be; Industrial Disease?"


--  

        Ken Knight, Ken.Knight@f421.n109.z1.fidonet.org
      via The Black Cat's Shack's FidoNet<->Usenet Gateway
          blkcat.fidonet.org   and   Fidonet 1:109/401