[comp.sys.mac.hypercard] Event Tracking in HyperCard pt 2

IRV.KANODE@f53.n114.z1.fidonet.org (IRV KANODE) (03/29/90)

---Track Mouse in Button, and Mouse Clicks in Button---
                             (This is the button script)
        
on mouseEnter
  global StartingTicksVariable
  put the ticks into StartingTicksVariable
end mouseEnter
        
on MouseDown
  global clickVariable
  put " click " after clickVariable
  --HyperCard logs rapid clicks are logged as single clicks
end MouseDown
        
on MouseLeave
    global StartingTicksVariable, FldOneVariable, clickVariable
    put the ticks into EndingTicksVariable
    put the short name of me & " " after bg fld Events
    --Identify the button
    put EndingTicksVariable - StartingTicksVariable after bg fld Events
    --Log the time the mouse was within the button
    if clickVariable is not empty then
        put clickVariable & RETURN after bg fld Events
        --If the user clicked, log the clicks
        put empty into clickVariable
        --reset click counter
    else
        put RETURN after bg fld Events
    end if
end mouseLeave
========================
        
----- To Track *Most* Menu Selections ------
                (This is the stack script.)
        
on doMenu whichItem
  put "Menu Choice: " & whichItem & Return after bg fld Events
  pass doMenu
end doMenu
 

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!53!IRV.KANODE
Internet: IRV.KANODE@f53.n114.z1.fidonet.org