What need an idle message to start ?

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
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

What need an idle message to start ?

Post by jmburnod » Tue Apr 09, 2013 4:18 pm

Hi All,
I have an idle message on the cd script

Code: Select all

on idle
   if the environment <> "mobile" then
      set the hilite of btn "bMultipleSelection" to (shiftKey() is down)
   end if
   pass idle
end idle
Don't work after the opencard message.
If I clic on an other stack, idle message start
I feel i forget something basic :oops:
Best regards
Jean-Marc
https://alternatic.ch

magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: What need an idle message to start ?

Post by magice » Tue Apr 09, 2013 4:46 pm

This doesn't exactly answer your question, but every time I have started out with an idle message, I have found a way to use the send command in its place and it had worked more efficiently. Rather than fight with making the idle work, you might be better off just creating a polling system with send to in time.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: What need an idle message to start ?

Post by jmburnod » Tue Apr 09, 2013 4:50 pm

Thanks for your reply
I'll do that
Best regards
Jean-marc
https://alternatic.ch

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: What need an idle message to start ?

Post by Dixie » Tue Apr 09, 2013 8:26 pm

What are you trying to do here ?

Dixie

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: What need an idle message to start ?

Post by jmburnod » Tue Apr 09, 2013 10:14 pm

Hi John,

I doesn't try. I do :D
It seems a pendingmessage will be better than an idle message to set the hilite of a btn to the shiftKey() is down
https://alternatic.ch

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: What need an idle message to start ?

Post by jmburnod » Tue Apr 09, 2013 10:38 pm

Magice,
I confirm pendingmessage is better than idle message in this case

Code: Select all

on DoCheckShift
   set the hilite of btn "bMultipleSelection" to (shiftKey() is down)
   if "DoCheckShift"  is not in the pendingmessages then
      send "DoCheckShift" to me in 10 milliseconds
   end if
end DoCheckShift
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: What need an idle message to start ?

Post by bn » Tue Apr 09, 2013 11:16 pm

Hi Jean-Marc,

if you use 10 milliseconds you make a very tight loop.

I think the screen refresh is every 16 milliseconds = 1 tick. The shortest mouseMove intervall is 16 milliseconds.

For user interface things everything below 100 milliseconds is barely noticeable. Especially if you have to push a key on the keyboard one is distracted and this shortens the perceived latency.

I tried with 150 milliseconds in the loop and that seems to respond quite immediately. 200 and more milliseconds start to show latency.

The short story is you don't need a 10 millisecond loop it strains the program unnecessarily.
And please make shure to clear all your pendingMessages when e.g. you leave the card. Windows Standalones don't like continuing messaging when closing and refuse to close. On a Mac it kills the messages somehow

Code: Select all

on closeCard
   repeat for each line aLine in the pendingMessages
      if aLine contains "DoCheckShift" then cancel item 1 of aLine
   end repeat
   set the hilite of btn "bMultipleSelection" to false
end closeCard
Kind regards
Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: What need an idle message to start ?

Post by jmburnod » Tue Apr 09, 2013 11:28 pm

Hi Bernd,
Thanks one more for your comments.
I just tested the interval for the pending message and you're right, 150 milliseconds work fine
make shure to clear all your pendingMessages
Yes, i killed the pending message at closecard
Kind regards
Jean-Marc
https://alternatic.ch

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: What need an idle message to start ?

Post by jmburnod » Thu Apr 25, 2013 4:17 pm

Hi All,
Using shiftkey() to change the hilitedlines selection mode wasn't a good idea (multipleHilitedlines or not)
It work normally and logically (like a multipleHilitedlines with the shifkey() = true

I use a checkbox instead shiftkey() and I can live with that.
By the way, if someone have a light idea, I will take it
Best regards
Jean-Marc
https://alternatic.ch

Post Reply