Program running in "Edit Mode"

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Surbhit29
Posts: 80
Joined: Thu Aug 16, 2012 1:25 pm

Program running in "Edit Mode"

Post by Surbhit29 » Thu Aug 23, 2012 12:03 pm

I am new to live code. But this problem is irritating me. Sometimes it happens that after I write a program in LiveCode and after running it when I switch back to "Edit Mode" the program is still running.
For eg. I have given aeChangeRect command for an object but when I try to move the object to some place else on the card after switching it back to "Edit Mode" the object automatically goes to its old place.
Please help.

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Program running in "Edit Mode"

Post by shaosean » Thu Aug 23, 2012 12:47 pm

Was the animation engine command completed before switching to Edit mode? Is there something in your code that might be reseting the location of the object?

Surbhit29
Posts: 80
Joined: Thu Aug 16, 2012 1:25 pm

Re: Program running in "Edit Mode"

Post by Surbhit29 » Thu Aug 23, 2012 1:04 pm

Animation engine command was completed.

Code: Select all

on mouseDown
   grab me
end mouseDown

on mouseMove
   if within (graphic "innerPoly", the mouseloc) then
      revRotatePoly the long ID of graphic "outerPoly",45 
      aeChangeRect the long ID of grc "outerPoly",the rect of grc "innerPoly", 1000
   end if
end mouseMove
Is their a problem in it?

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Program running in "Edit Mode"

Post by sturgis » Thu Aug 23, 2012 2:05 pm

Since livecode is "live" certain things keep functioning no matter what mode you are in. If you are in edit mode, and click an object the ide catches the click and selects the object. But the object is still sitting there waiting for a click, the ide just keeps it from getting it.

The same applies for mousemove but the engine doesn't 'catch' it, so your mousemove works no matter what mode you're in.

There are a couple ways around this. You can turn off messages before moving that object (you can click the little envelope icon on the menu bar) or you can add a line like the following at the top of your mousemove:

Code: Select all

if the tool is "pointer tool" then exit mousemove

At least I _think_ this is what is going on.

Surbhit29
Posts: 80
Joined: Thu Aug 16, 2012 1:25 pm

Re: Program running in "Edit Mode"

Post by Surbhit29 » Thu Aug 23, 2012 2:18 pm

Thnx a lot Strugis.
Will try it. :)

Post Reply