Page 1 of 2
App pause while dragging window
Posted: Fri Mar 28, 2014 8:49 pm
by croivo
I have simple count up code for my clock, and it works good but when I click (and hold or move) on border of the window it pause counting up until I release mouse click. How to 'fix' this to work ALL the time?
Here is my code:
Code: Select all
set the numberformat to 00
add 1 to field ClockSec of card controller
if field ClockSec of card controller = 60
then
add 1 to field ClockMin of card controller
put 00 into field ClockSec of card controller
else
end if
Re: App pause while dragging window
Posted: Fri Mar 28, 2014 8:57 pm
by FourthWorld
Can we see the full handler?
Re: App pause while dragging window
Posted: Fri Mar 28, 2014 8:59 pm
by croivo
Code: Select all
on mouseUp
If the label of ME is "Start" then
set the label of ME to "Stop"
set the backgroundcolour of ME to red
DoCountUp
else
set the label ME to "Start"
set the backgroundcolour of ME to green
end if
end mouseUp
on DoCountUp
if label of ME is "Stop"
then
set the numberformat to 00
add 1 to field GameClockSec of card controller
if field GameClockSec of card controller = 60
then
add 1 to field GameClockMin of card controller
put 00 into field GameClockSec of card controller
else
end if
send "DoCountUp tNewTime" to me in 1 second
end if
end DoCountUp
Re: App pause while dragging window
Posted: Fri Mar 28, 2014 9:03 pm
by Mark
Hi,
You can't do what you want. When you drag a window, the IDE locks up until you release the mouse. However, there are smarter ways to update a time display. Here's an example:
Code: Select all
local lStartTime
on updateTime
if lStartTime is empty then
put the seconds into lStartTime
end if
put the seconds - lStartTime into myLapsedSeconds
put myLapsedSeconds div 60 into myMinutes
put myLapsedSeconds mod 60 into mySeconds
put myMinutes & colon & mySeconds into fld "Time"
// there are better ways to do this, but this is just an example
send "updateTime" to me in 500 milliseconds
end updateTime
on stopTime
put the pendingMessages into myMessages
filter myMessages with "*updateTime*"
repeat for each line myMsg in myMessages
cancel item 1 of myMsg
end repeat
end stopTime
Kind regards,
Mark
Re: App pause while dragging window
Posted: Fri Mar 28, 2014 9:06 pm
by Mark
Hi again,
Starting from your moueeUp handler:
Code: Select all
on mouseUp
If the label of ME is "Start" then
set the label of ME to "Stop"
set the backgroundcolour of ME to red
updateTime
else
set the label ME to "Start"
set the backgroundcolour of ME to green
stopTime
end if
end mouseUp
If you use my example, you'll need a field with the name "Time".
Kind regards,
Mark
Re: App pause while dragging window
Posted: Fri Mar 28, 2014 9:07 pm
by croivo
Thanks Mark!
Can this maybe be new feature request for new version of LiveCode?
Re: App pause while dragging window
Posted: Sat Mar 29, 2014 7:37 pm
by jacque
It is possible to respond to a window drag. Use a moveStack handler to send an update to your time field when that happens:
Code: Select all
on moveStack
updateTime
end moveStack
You should use Mark's updateTime calculation because it calculates the correct time increase based on the current time, which will prevent errors in the time display.
Re: App pause while dragging window
Posted: Thu Apr 16, 2015 10:08 pm
by croivo
Is there any handler that detects when the mouse has clicked on title bar of stack? moveStack works only when stack is moving...
Re: App pause while dragging window
Posted: Fri Apr 17, 2015 4:22 pm
by jacque
croivo wrote:Is there any handler that detects when the mouse has clicked on title bar of stack? moveStack works only when stack is moving...
Not really. What do you need to do?
Re: App pause while dragging window
Posted: Fri Apr 17, 2015 4:39 pm
by dunbarx
Even "mouseMove" is not sent when the cursor is outside the rect of the card window, or that could be exploited. I wonder if that would be a nice feature, to have it in fact do so.
Anyway, I am with Jacque; what are you looking to do?
Craig Newman
Re: App pause while dragging window
Posted: Fri Apr 17, 2015 6:15 pm
by Klaus
Hi all,
maybe the "moveStack" message can help here?
This is sent to the current card while the user drags the stack window!
Best
Klaus
Re: App pause while dragging window
Posted: Fri Apr 17, 2015 7:39 pm
by jacque
The OP eliminated the movestack option:
moveStack works only when stack is moving...
Re: App pause while dragging window
Posted: Fri Apr 17, 2015 8:13 pm
by Klaus
jacque wrote:The OP eliminated the movestack option:
moveStack works only when stack is moving...
I promise to read and understand the complete thread the next time!

Re: App pause while dragging window
Posted: Sat Apr 18, 2015 11:46 am
by croivo
I have some count up timers in my stack and when you click on the title bar of an app, it pauses the count up timer. So I thought maybe I can do that count up code when the mouse is down on title bar...
Re: App pause while dragging window
Posted: Sat Apr 18, 2015 7:00 pm
by jacque
I don't see any pause when I run a test handler on my Mac. What OS are you on? Also, post your count-up handler and we can look.