Why resizing a stack terminates my scripts

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
danielrr
Posts: 142
Joined: Mon Mar 04, 2013 4:03 pm

Why resizing a stack terminates my scripts

Post by danielrr » Thu Jun 13, 2013 11:32 am

I have one definite card in one definite stack that shows a strange (and ultimately annoying) behaviour. Whenever I reset the size of the stack using a line of code like the following, the stack (and the card within) do resizes to the right dimensions, but any script stops there after resizing

set the rectangle of this stack to "0,0,1000,500"

I have tried with several dimensions to resize, to no avail. I can resize any other card of the same stack with the same line, but not this one. Anybody has a guess about what can be happening? I'm using LC 5.5.1 on a 2Gz Intel core i7 iMac OSX 10.7.5

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

Re: Why resizing a stack terminates my scripts

Post by jmburnod » Thu Jun 13, 2013 11:55 am

hi danierr,

I tried your script and I was suprised it work.
I don't know that a rect between quotes works
Try without quotes
Can you post your stack and we can see also the scripts which don't work ?

Best regards
Jean-Marc
https://alternatic.ch

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

Re: Why resizing a stack terminates my scripts

Post by dunbarx » Thu Jun 13, 2013 1:56 pm

I always use quotes when referencing rects or points. I did not know you could do without.

But what do you mean when you say that the script stops? If the resize line is in the middle of a running script, are you saying it exits at that point?

on mouseUp
beep 2
set the rectangle of this stack to "0,0,1000,500"
beep 2
end mouseup

The last line is not executed?

Craig Newman

danielrr
Posts: 142
Joined: Mon Mar 04, 2013 4:03 pm

Re: Why resizing a stack terminates my scripts

Post by danielrr » Thu Jun 13, 2013 3:42 pm

that's what I meant, Craig, but now, after using your "dummyscript" in several environments, I can be more precise: If I use the dummyscript as it is, on its own, in a simple button, then evererything goes right and you'll hear four beeps. But (I suppose that's really meaningful) if you put the script in the "opencard" handler, then you'll hear only the first two beeps.

I mean, if you execute (in this particular card, and in no other card of that stack!)

on openCard
beep 2
set the rectangle of this stack to "0,0,1000,500"
beep 2
end mouseup

the stack will resize to the indicated sice but the last line of the script is not executed.

danielrr
Posts: 142
Joined: Mon Mar 04, 2013 4:03 pm

Re: Why resizing a stack terminates my scripts

Post by danielrr » Thu Jun 13, 2013 3:50 pm

... I have the suspicion that the resizing of this card (I mean the resizing of the stack as you are in this card) conflicts with some attribute of some of the card's object. My uneducated guess is that this attribute may be a "fixed location" or some object's geometry of sorts but (If the guess is sound) how can you detect which object is conflicting with the resizing? (there's more than a hundred objects in that card alone)

danielrr
Posts: 142
Joined: Mon Mar 04, 2013 4:03 pm

Re: Why resizing a stack terminates my scripts

Post by danielrr » Thu Jun 13, 2013 5:14 pm

More info, in the hope somebody can give it a meaning.

If I put a line that resizes the stack inside a openCard instruction, what I normally can read in the message watcher is something like the following:

openCard 5:59:22 PM (61)
tamannoStack 5:59:22 PM (0) --this is the handler containing the resize instruction
cREVGeometryCache 5:59:22 PM (18) --I ask for the location of some stuff
cREVGeometry 5:59:22 PM (0)
resizeStack 5:59:22 PM (3) --the resize stack instruction and...
idle 5:59:23 PM (615) --everything went smooth


BUT in the offending card, the very same hadler produces the following

opencard 6:04:08 PM (0)
tamannoStack 6:04:08 PM (0) --this is the handler containing the resize instruction
cREVGeometryCache 6:04:08 PM (26) --I ask for the location of some stuff
cREVGeneral 6:04:08 PM (1)
cREVGeometry 6:04:08 PM (0) --no "resizeStack" message. Instead, this line appears several times
cREVGeometry 6:04:08 PM (0)
cREVGeometry 6:04:08 PM (0)
cREVGeometry 6:04:08 PM (0)
cREVGeometry 6:04:08 PM (0)

The precise handler is exactly this one

on tamannoStack
put fld "tamannosTarjetas" into tamannosTarjetas
if short name of this card is in tamannosTarjetas
then
get devLin(nCard,tamannosTarjetas) --returns the number in a field where the "right" dimensions of eevry card is stored
put line it of tamannosTarjetas into lalin
get item 2 to 5 of lalin
put the location of this stack into laLoc
set the rectangle of this stack to it
set the location of this stack to laLoc
beep 2 --prueba
end if
end tamannoStack

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

Re: Why resizing a stack terminates my scripts

Post by dunbarx » Thu Jun 13, 2013 6:33 pm

What happens if you step through the "dummy" script in the debugger? Make sure you step "into", not step "over".

Craig

danielrr
Posts: 142
Joined: Mon Mar 04, 2013 4:03 pm

Re: Why resizing a stack terminates my scripts

Post by danielrr » Thu Jun 13, 2013 6:52 pm

When I step through the "dummy" script in the debugger, the script terminates most ungently likewise

danielrr
Posts: 142
Joined: Mon Mar 04, 2013 4:03 pm

Re: Why resizing a stack terminates my scripts

Post by danielrr » Thu Jun 13, 2013 7:56 pm

uh, one more thing. The card missbehaviour occurs only when you try to resize it from the stack script. If you do it from any script in the same card, then alles ist Gut

danielrr
Posts: 142
Joined: Mon Mar 04, 2013 4:03 pm

Re: Why resizing a stack terminates my scripts

Post by danielrr » Thu Jun 13, 2013 10:10 pm

News from the "trial and error" front:

I have been able to identify the source of the strange behaviour, but not the cause of it, as doctors use to do.

The cause were two table fields, that's it. I created a dummy, empty card, run a script to copy each and every object from the original card into the new one and soon it turned out those two table fields were the only culprits.
The strange thing is they were rather inane: they contained no script and their only function was to display a visible grid upon which certain objects had to appear. Once I have deleted them, the card resizes as it should do.

I leave the plausible explanations to the gurus of the list.

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

Re: Why resizing a stack terminates my scripts

Post by dunbarx » Fri Jun 14, 2013 12:05 am

Would you mind uploading the culprit stack?

Craig

danielrr
Posts: 142
Joined: Mon Mar 04, 2013 4:03 pm

Re: Why resizing a stack terminates my scripts

Post by danielrr » Fri Jun 14, 2013 1:21 am

Craig, the whole stack is a huge (mean huge) stack with lots of code about very specific projects. I'll be glad to contribute with all kind of implicated scripts but I don't think the whole stack's deposition would add something meaningful to the general cause

Post Reply