Listing 3.

on mouseUp
  switch the short name of the target
  case "Kill Process"
    kill process word 1 of the selectedText\
         of field "toplist"
    updatelist
    break
  case "Set Update Interval..."
    ask "Set update interval to:"\
         with the updateinterval of me
    if it is not a number then
      answer "Interval must be a number."
    else
      set the updateinterval of me to it
      cancel timerId
      updatelist
    end if
    break
  case "Close"
    close this stack
    break
  case "toplist"
    enable button "Kill Process"
    cancel timerId
    send "updatelist" to me in 5 seconds
    put the result into timerid
    break
  end switch
end mouseUp