Running scripts when changing cards

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: Klaus, FourthWorld, heatherlaine, kevinmiller

Running scripts when changing cards

Postby ittarter » Mon Jul 17, 2017 9:06 am

Hi all,

I'm noticing a problem. When users behave, ahem, faster than I anticipated, for example leaving a card when things are still happening, errors happen. Scripts are running but I've not identified objects by what card/stack they're on. So the handlers continue to run but now they cause errors because object x doesn't exist on the card that the user has now moved to.

Users have buttons they can click to move to another card. I was wondering if it would be possible to either
a. create a condition where they would not not go to another card before the running scripts had a chance to finish;
b. cancel/abort ALL running handlers before sending the message to open a different card

Any advice for me? Thanks!
ittarter
 
Posts: 100
Joined: Sat Jun 13, 2015 2:13 pm

Re: Running scripts when changing cards

Postby jmburnod » Mon Jul 17, 2017 10:25 am

Hi,
There is many way to prevent that:
1. set the lockmessages to false at the top of your running message and false at the end
2. Hide btn goNextCd at the start of your running message and show it at the end
3.Disable and set blendlevel to 40 of btn goNextCd at the start of your running message and enable it and set blendlevel to 0 of it at the end
... Sure there is other ways and the question will be "what is the best for your context

Best regards
Jean-Marc
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 1929
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève

Re: Running scripts when changing cards

Postby dunbarx » Mon Jul 17, 2017 4:55 pm

What Jean-Marc said.

I would never allow the user to abort a handler before it was finished, unless that was part of the original plan. I vote to disable rather than hide. It gives the user feedback to keep his hands to himself.

Craig Newman
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 4792
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Running scripts when changing cards

Postby ittarter » Mon Jul 17, 2017 5:37 pm

So far, the disable option sounds the most promising.

I could even have a standard bit of code where, if the cursor is set to watch, buttons become unresponsive. And then just set the cursor to watch/arrow at the start/end of each handler. Does that sound like a decent solution? It gives the user "hands to himself" feedback without constantly changing the look of the card.
ittarter
 
Posts: 100
Joined: Sat Jun 13, 2015 2:13 pm

Re: Running scripts when changing cards

Postby dunbarx » Mon Jul 17, 2017 6:17 pm

Cursor feedback is both comforting and informative. I don't know about several different styles of cursor, though, as this may be overkill. Keep it to a single additional "wait" cursor of your choice. Know that images of any kind may be employed, so you are not limited to watches and pointers.

Craig
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 4792
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Running scripts when changing cards

Postby ittarter » Tue Jul 18, 2017 11:34 pm

I meant just two style of cursor. Watch means wait, arrow means do what you want. Those are the only ones I'm familiar with. I'm sure there's a list somewhere but I'm happy with those two.
ittarter
 
Posts: 100
Joined: Sat Jun 13, 2015 2:13 pm

Re: Running scripts when changing cards

Postby bogs » Wed Jul 19, 2017 1:25 am

There is actually a list in the dictionary, under 'Cursor' -
Image
Image
bogs
 
Posts: 381
Joined: Sat Feb 25, 2017 10:45 pm


Return to Getting Started with LiveCode - Complete Beginners

Who is online

Users browsing this forum: Google [Bot] and 4 guests