Why errors between LiveCode 6.1.3 and LiveCode 6.5.0?

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
joop1943
Posts: 10
Joined: Thu Oct 10, 2013 1:10 pm

Why errors between LiveCode 6.1.3 and LiveCode 6.5.0?

Post by joop1943 » Sun Dec 08, 2013 4:11 pm

Hi,

I did make a stack with 2 cards.
The stack has the following scripts:

Stack Script:
--------------------------------------------------------------------------------------------------------------
global stackHorizontaleLocatie, stackVerticaleLocatie
global stackHorLoc, stackVertLoc

on preOpenStack
set the width of this stack to (item 3 of the working screenrect)*0.8
set the height of this stack to round ((the width of this stack * 9 / 16),0)
put round ((the width of this stack / 2),0) into stackHorLoc
put round ((the height of this stack / 2 + 44),0) into stackVertLoc
set the location of this stack to (stackHorLoc & "," & stackVertLoc)
pass preOpenStack
end preOpenStack

on moveStack horPosLeft, vertPosTop
put round ((horPosLeft +the width of this stack / 2),0) into stackHorLoc
put round ((vertPosTop + the height of this stack / 2),0) into stackVertLoc
set the location of this stack to (stackHorLoc & "," & stackVertLoc)
end moveStack


Card script (for each card)
--------------------------------------------------------------------------------------------------------------
global stackHorLoc, stackVertLoc

on preOpenCard
initCard
end preOpenCard

on resizeStack newWidth,newHeight
initCard
pass resizeStack
end resizeStack

on initCard
set the location of this stack to (stackHorLoc & "," & stackVertLoc)
set the height of this stack to round ((the width of this stack *9 /16),0)
end initCard

--------------------------------------------------------------------------------------------------------------

When I save the stack in LiveCode 6.1.3, close LiveCode 6.1.3, start LiveCode 6.1.3 and open the Stack, it doesn't give any errors.
When I Quit LiveCode 6.1.3 and Open the same stack in LiveCode 6.5.0, I get 2 error messages with the same text:

--------------------------------------------------------------------------------------------------------------

executing at 4:01:05 PM
Type Object: coordinate is not a point
Object card id 1002
Line set the location of this stack to (stackHorLoc & "," & stackVertLoc)
Hint

--------------------------------------------------------------------------------------------------------------

Then, when I save the stack in LiveCode 6.5.0, close LiveCode 6.5.0, start LiveCode 6.5.0 and open the Stack, it doesn't give any errors.
When I Quit LiveCode 6.5.0 and Open the same stack in LiveCode 6.1.3, I get these 2 error messages again with the same text.

Does anyone know why?
Thanks
Joop1943

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4168
Joined: Sun Jan 07, 2007 9:12 pm

Re: Why errors between LiveCode 6.1.3 and LiveCode 6.5.0?

Post by bn » Sun Dec 08, 2013 8:27 pm

Hi Joop1943,

I see the error when opening the stack in 6.1.3 or 6.5.0

The reason for the error is that you trigger a resize in your preOpencard script by setting the width and the height of the stack before filling the global variables. The resize triggers the resizeStack handler which in turn calls the initCard handler which needs the global variables stackHorLoc & "," & stackVertLoc. Those are not filled in your version of the script at first calling.

replace the preOpenCard handler with the one I post below.

You might want to consider to put the card script into the stack script because right now there is no reason I see that the card script has to be repeated in every card.
I left out the initialization of the global variables.

Code: Select all

on preOpenStack
   put item 3 of the working screenrect * 0.8 into tNewWidth
   put round ((tNewWidth *9/16),0) into tNewHeight
   
   put round ((tNewWidth / 2),0) into stackHorLoc
   put round ((tNewWidth / 2 + 44),0) into stackVertLoc
   set the location of this stack to (stackHorLoc & "," & stackVertLoc)
   pass preOpenStack
end preOpenStack
Kind regards
Bernd

joop1943
Posts: 10
Joined: Thu Oct 10, 2013 1:10 pm

Re: Why errors between LiveCode 6.1.3 and LiveCode 6.5.0?

Post by joop1943 » Mon Dec 09, 2013 11:37 am

Hi Bernd,

Thank you for your explanation and your script.
Thanks to you all is clear to me.

In the 5th script-line there is a typo, I presume.
In the line put round ((tNewWidth / 2 + 44),0) into stackVertLoc tNewWidth must be tNewHight.

I did check the variables stackHorLoc and stackVertLoc in the MessageBox.
When I did so, they contained the right values.
So I didn't understand at all what was happening.

Again thank you very much.

Kind regards,

Joop Sleijster

Post Reply