canceling button script

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
ferhan24badshah
Posts: 35
Joined: Sun Feb 02, 2014 12:20 am

canceling button script

Post by ferhan24badshah » Sat Feb 22, 2014 8:07 am

how can we stop the execution of a script embedded in button A by clicking on button B.

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

Re: canceling button script

Post by dunbarx » Sat Feb 22, 2014 8:13 am

Hi.

You can do this by including a test in the "A" script, though I would imagine it will be in a loop. Something like:

if the mouse is down and the mouseLoc is within the rect of btn "b" then...

Craig Newman

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: canceling button script

Post by Simon » Sat Feb 22, 2014 8:18 am

Hi Ferhan,
I showed you that here;
http://forums.runrev.com/phpBB2/viewtop ... 263#p97046
In that I used the optionKey but it could have been a button on a card.

If that is not what you meant then just write back, saying how you would need it different.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: canceling button script

Post by dunbarx » Sun Feb 23, 2014 7:17 am

Simon makes, (likely, since I have not seen what he sent you) the same point, in that some property outside the script can be used as a way to interrupt that script.

I am sure that he suggests testing for the state of the optionKey, just like I suggested testing for the condition of the mouse in conjunction with its loc.

The lesson here is the same. You create an environment where this sort of thing is managed. A further lesson is to understand how LC makes its inner workings accessible, in a very "live" way, and provides the hooks you can exploit to do what you need.

Craig

Post Reply