Grab stops working in stanalone version

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
joeMich
Posts: 20
Joined: Tue Jun 06, 2006 8:24 am

Grab stops working in stanalone version

Post by joeMich » Fri Jan 18, 2008 1:05 pm

I made a set of stacks to ease the job of a collegue of mine in making tickets.
There is a form stack, where the user can fill out fields and ad a picture to use.
I wanted to use the grab option to enable the choosen picture to be placed freely within a constraint box.

In the print-stac (from where the tickets are printet :D ) i wanted the movement of the picture to be reflected.

(I used a script of Jan Schenkel to do this!....)

This works all fine before making the standalone, but when the app is made standalone the grab option dissapears when refreshing changing the picture.

I there a problem using "grab" in standalones?

best regards
Johan

There is a copy of the stack(s) on:

http://home13.inet.tele.dk/orgel/comput ... tStak.html

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Jan 18, 2008 2:18 pm

Hi Joe,

Your script causes a recursion error. Your mouseMove handler does a lot of unnecessary things. It updates all relevant values everywhere in your stack while the picture is moved around. Because of the send command and the asynchronic nature of both the mouseMove and the send commands, your stack is still updating values while the next command to update these values has been sent already. Hence the recursion error. Perhaps, on a slow computer, the error doesn't occur in the IDE, because the IDE environment is just too slow to have commands sent before the previous commands has been handled.

So, you might do the following, in pseudocode:

Code: Select all

on mousemove
  get the new location for the picture
  if the new location is allow then
    set the new location for the picture
  else
    calculate where the picture should be
    set the new location for the picture
  end if
end mouseMove

on mouseRelease
  update all relevant values
  clean up
end mouseRelease

on mouseUp
  mouseRelease
end mouseUp
This might help.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

joeMich
Posts: 20
Joined: Tue Jun 06, 2006 8:24 am

Thanks!

Post by joeMich » Fri Jan 18, 2008 5:45 pm

Thanks for the response!

I shall try to simplify the update-handler as well as the grab-script

best regards
Johan

Post Reply