mouse no movement timer

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
herbwords
Posts: 70
Joined: Sat Dec 01, 2007 2:59 am

mouse no movement timer

Post by herbwords » Fri Nov 30, 2012 7:30 pm

Hi,
I'm tying to get a button to change it's name to No User and another button to change it's name to Open with a green background when the mouse is not moved after 5 minutes. The compiler keeps telling me (compilation error at line 11 (Commands: missing ',') near "into", char 25) see below. Any suggestions?

on moveStopped
put the seconds into lStart
updateMouseTime
end moveStopped

on updateMouseTime
if the name of btn id "3895" is "No User" then
exit updateMouseTime
put the seconds – lStart into tElapsedTime -- warning says - compilation error at line 11 (Commands: missing ',') near "into", char 25
if tElapsedTime > 300 seconds then
set the name of btn id "3895" to "No User"
set the backgroundColor of btn id "3898" to "green" --backgroundColor
set the name of btn id "3898" to "Open"
end if
end if
end updateMouseTime

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: mouse no movement timer

Post by Klaus » Fri Nov 30, 2012 7:34 pm

Hi,

did you declare "lStart" as LOCAL or GLOBAL?


Best

Klaus

herbwords
Posts: 70
Joined: Sat Dec 01, 2007 2:59 am

Re: mouse no movement timer

Post by herbwords » Fri Nov 30, 2012 8:17 pm

Klaus, I forgot that! But I put in a global since you mentioned it and it did the same thing.

global lStart

on moveStopped
put the seconds into lStart
updateMouseTime
end moveStopped


on updateMouseTime
if the name of btn id "3895" is "No User" then
exit updateMouseTime
put the seconds – lStart into tElapsedTime -- warning says - compilation error at line 11 (Commands: missing ',') near "into", char 25
if tElapsedTime > 300 seconds then
set the name of btn id "3895" to "No User"
set the backgroundColor of btn id "3898" to "green" --backgroundColor
set the name of btn id "3898" to "Open"
end if
end if
end updateMouseTime

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: mouse no movement timer

Post by dunbarx » Fri Nov 30, 2012 11:34 pm

Hi.

It's always the little things. And the big things.

First, A danger in LC is that because it is so english-like, beginners fall into language traps. The machine will trip even if you talk to it with good grammar, but with bad syntax. Lose "seconds" in the line with the "if".

Second, something is wrong with the "-" in the line "put..."

This was a puzzler until I later checked out what you wrote. It is not a dash (minus operator), it is charToNum(208). Just lose that section, and rewrite with a normal "-".

Next, play with passing the seconds as a parameter to the handler. Then you don't ever need a global. Write back if that is not clear. Keep at it.

Craig Newman

Post Reply