Fwd: Best way to set up an idle timer - not like this
Devin Asay
devin_asay at byu.edu
Fri Aug 15 15:31:02 EDT 2003
Wait! What seemed to be working at first is not. It seems okay until
you start examining the pendingMessages. For some reason the sent
messages start queuing up rapidly as soon as you start mousing around
in the stack. Obviously the cancel command in the resetLogout handler
is not getting all of the pending messages. But I can't figure out
where all of these pendingMessages are coming from.
Any experts out there in this area that can tell me where I've gone
wrong?
Devin
Begin forwarded message:
[my previous intro clipped]
> ========================start script sample==========================
> -- first of all put into an otherwise unused script:
> on mouseMove
> send "resetLogout" to stack "chinpr"
> pass mouseMove
> end mouseMove
>
> on rawKeyDown
> send "resetLogout" to stack "chinpr"
> pass rawKeyDown
> end rawKeyDown
>
> -- then I put into my stack script:
>
> on openStack
> -- start timeout counter
> insert the script of image "P&Rbg1.jpg" into front
> send "logoutQuery" to stack "chinpr" in 5 * 60 seconds -- or
> whatever time you want
> end openStack
>
> on logoutQuery
> if the userPIN of this stack is not empty then -- i.e., if the user
> is logged in
> answer "A appropriate prompt here." with "Logout" or "Enter PIN..."
> if it is "Enter PIN..." then -- (user chose to continue)
> repeat forever -- or could put a limit here
> ask information "Enter your PIN to continue the test."
> if it is the userPIN of this stack then
> resetLogout
> exit repeat
> else
> answer information "Incorrect PIN. Try Again or Logout?"
> with "Logout" or "Try Again"
> if it is "Logout" then
> go card "menu" of stack "chinpr"
> logout
> exit repeat
> end if
> end if
> end repeat
> exit logoutquery
> else if it is "Logout" then -- (user chose to log out)
> go card "menu" of stack "chinpr"
> logout
> exit logoutQuery
> end if
> end if
> end logoutQuery
>
> on resetLogout
> cancel item 1 of last line of the pendingMessages
> send "logoutQuery" to stack "chinpr" in 5 * 60 seconds
> end resetLogout
>
> ========================end script sample==========================
Devin Asay
Humanities Technology and Research Support Center
Brigham Young University
More information about the use-livecode
mailing list