Confusing Error Message Generated by Object Resizing Handler
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Confusing Error Message Generated by Object Resizing Handler
Hi all,
I have been laying out a card, and I have a simple handler to resize the objects on the card. When I run the script, it spits out an enigmatic error message that has me totally stumped.
The error message is as follows:
card "Contact Profile": execution error at line n/a (Object: property is not an integer) near "-14857.83"
I have no idea how I can cause an error with no line, or what property it's referring to that needs to be an integer. Nor have I any idea what the number in quotes is.
Let me know if I should post some of the code for inspection, but it truly is just scaling and locating the edges of various objects to keep the card layout ratios consistent upon window resizing.
Thanks,
Phil E.
I have been laying out a card, and I have a simple handler to resize the objects on the card. When I run the script, it spits out an enigmatic error message that has me totally stumped.
The error message is as follows:
card "Contact Profile": execution error at line n/a (Object: property is not an integer) near "-14857.83"
I have no idea how I can cause an error with no line, or what property it's referring to that needs to be an integer. Nor have I any idea what the number in quotes is.
Let me know if I should post some of the code for inspection, but it truly is just scaling and locating the edges of various objects to keep the card layout ratios consistent upon window resizing.
Thanks,
Phil E.
Re: Confusing Error Message Generated by Object Resizing Han
Post your script...
Dixie
Dixie
Re: Confusing Error Message Generated by Object Resizing Han
Code: Select all
global tGap
on preOpenCard
put (the width of this stack * 0.025) into tGap
scaleObjects
layoutCard
end preOpenCard
on resizeStack
scaleObjects
layoutCard
end resizeStack
on scaleObjects
#Scale the title box header graphic to the card
set the height of graphic "Title Box" of me to (the height of this stack * 0.1)
set the width of graphic "Title Box" of me to the width of this stack
#Scale the title label to the card
set the width of field "title" of me to (the width of this stack * 0.25)
set the height of field "title" of me to (the height of graphic "Title Box" of this card * 0.8)
//put max(32,the height of group "contact list" of me/10) into tTextHeight
put (the height of graphic "Title Box" of me/3) into tTextHeight
set the textSize of field "Title" of me to tTextHeight
//set the textHeight of field "title" of me to tTextHeight
#Scale the contact picture image
set the width of image "Contact Picture" of me to (the width of this stack * 0.3)
set the height of image "Contact Picture" of me to (the width of this stack * 0.3)
#Scale the contact information fields
put (the height of this stack * 0.06) into tContactInfoHeight
put (the width of this stack * 0.625) into tContactInfoWidth
//Contact name field
set the width of field "Contact Name" of me to the width of image "Contact Picture" of me
set the height of field "Contact Name" of me to (tContactInfoHeight * 6 - the height of image "Contact Picture" of me - tGap)
#scale the text size
//Contact info fields
set the height of field "PhNumber" of me to tContactInfoHeight
set the width of field "PhNumber" of me to tContactInfoWidth
set the height of field "Email" of me to tContactInfoHeight
set the width of field "Email" of me to tContactInfoWidth
set the height of field "Location" of me to tContactInfoHeight
set the width of field "Location" of me to tContactInfoWidth
set the height of field "Birthdate" of me to tContactInfoHeight
set the width of field "Birthdate" of me to tContactInfoWidth
set the height of field "Sort List" of me to tContactInfoHeight
set the width of field "Sort List" of me to tContactInfoWidth
set the height of field "Fish Type" of me to tContactInfoHeight
set the width of field "Fish Type" of me to tContactInfoWidth
#Scale the notes label
set the width of field "Notes" of me to the width of this stack - 2 * tGap
set the height of field "Notes" of me to the height of this stack * (0.54 - 3 * tGap)
#Scale the header labels within the notes label
layoutCard
end scaleObjects
on layoutCard
#Position the title box header graphic
set the topLeft of graphic "Title Box" of me to 0,0
#Position the title label
set the left of field "Title" of me to (the width of this stack * 0.375)
set the top of field "Title" of me to (the height of graphic "Title Box" of me * 0.2)
#Position the contact picture image
set the topLeft of image "Contact Picture" of me to tGap,(the bottom of graphic "Title Box" of me + tGap)
#Position the contact information labels
//Contact name field
set the topLeft of field "Contact Name" of me to tGap,(the bottom of image "Contact Picture" of me + tGap)
//Contact info fields
set the topLeft of field "PhNumber" of me to (the width of image "Contact Picture" of me + 2 * tGap),(the height of graphic "Title Box" of me + tGap)
set the topLeft of field "Email" of me to the bottomLeft of field "PhNumber" of me
set the topLeft of field "Location" of me to the bottomLeft of field "Email" of me
set the topLeft of field "Birthdate" of me to the bottomLeft of field "Location" of me
set the topLeft of field "Sort List" of me to the bottomLeft of field "Birthdate" of me
set the topLeft of field "Fish Type" of me to the bottomLeft of field "Sort List" of me
#Position the notes label
set the topLeft of field "Notes" of me to tGap,(the height of graphic "Title Box" of me + the height of image "Contact Picture" of me + the height of field "Contact Name" + tGap * 3)
#Position the header labels within the notes label
end layoutCard
Re: Confusing Error Message Generated by Object Resizing Han
Hi.
Without going very deeply into your issue, please try the following:
put trunc(the width of this stack * 0.025) into tGap
and similarly for all of the decimal calculations you do farther down. Let's just make sure we have integers after all that scaling.
Craig Newman
Without going very deeply into your issue, please try the following:
put trunc(the width of this stack * 0.025) into tGap
and similarly for all of the decimal calculations you do farther down. Let's just make sure we have integers after all that scaling.
Craig Newman
Re: Confusing Error Message Generated by Object Resizing Han
Hi, Craig,
Thanks for the response!
So, that did make the number displayed in the error message an integer. However, the same error message is still displayed (albeit now, with the number "-14442" in place of what was previously "-14857.83").
So I don't know if the error message is saying that some property I inadvertently tried to make into an integer is instead a string, or something else...
I just do not know how to interpret the error message, particularly because I don't know where the number it references comes from.
Phil E.
Thanks for the response!
So, that did make the number displayed in the error message an integer. However, the same error message is still displayed (albeit now, with the number "-14442" in place of what was previously "-14857.83").
So I don't know if the error message is saying that some property I inadvertently tried to make into an integer is instead a string, or something else...
I just do not know how to interpret the error message, particularly because I don't know where the number it references comes from.
Phil E.
Re: Confusing Error Message Generated by Object Resizing Han
Hi Phil,
This is the only "minus" line I see:
set the width of field "Notes" of me to the width of this stack - 2 * tGap
Doubt you can have a - width.
Simon
This is the only "minus" line I see:
set the width of field "Notes" of me to the width of this stack - 2 * tGap
Doubt you can have a - width.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Confusing Error Message Generated by Object Resizing Han
Simon likely found it.
Is 2 * tGap greater than the width of the stack?
Craig Newman
Is 2 * tGap greater than the width of the stack?
Craig Newman
Re: Confusing Error Message Generated by Object Resizing Han
Actually I just put together a stack and am finding an error with this line:
set the height of field "Contact Name" of me to (tContactInfoHeight * 6 - the height of image "Contact Picture" of me - tGap)
Phil, you should turn the boarders on for all your fields and watch them. The above causes the height of field "Contact Name" to go into negative numbers as the stack resizes.
I'm not saying that this is "the" line that is causing you trouble but any of the lines which could cause a negative number size will throw an error.
I'm guessing that -14442 is being used to set the size of one of your objects.
Simon
set the height of field "Contact Name" of me to (tContactInfoHeight * 6 - the height of image "Contact Picture" of me - tGap)
Phil, you should turn the boarders on for all your fields and watch them. The above causes the height of field "Contact Name" to go into negative numbers as the stack resizes.
I'm not saying that this is "the" line that is causing you trouble but any of the lines which could cause a negative number size will throw an error.
I'm guessing that -14442 is being used to set the size of one of your objects.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Confusing Error Message Generated by Object Resizing Han
Simon and Craig,
tGap is the global variable I am using for spacing the different objects throughout the app; it is relatively small, being 2.5% of the stack width.
I will look at alternative ways to assign the height of the Contact Name field. I am thinking the number is being passed somewhere that doesn't recognize it, either. Is there a way to tell where the value is ending up, since the error message doesn't cite any line as the problem?
Now, time to display my lack of experience: what are these borders I need to turn on?
Phil E.
tGap is the global variable I am using for spacing the different objects throughout the app; it is relatively small, being 2.5% of the stack width.
I will look at alternative ways to assign the height of the Contact Name field. I am thinking the number is being passed somewhere that doesn't recognize it, either. Is there a way to tell where the value is ending up, since the error message doesn't cite any line as the problem?
Now, time to display my lack of experience: what are these borders I need to turn on?
Phil E.
Re: Confusing Error Message Generated by Object Resizing Han
Hi Phil,
In the field inspector you have the option to turn on the borders of the fields. I used it so that I could watch the fields change size.
2 Things:
1) take the script out of the preOpenCard for now (until this gets solved)
2) resize by dragging the corner, not maximising the window. This is so you can watch your field and see which is getting too small.
If the IDE is locking when you open the stack then turn the messages off (little envelope in the menu bar).
Yes, on opening the stack I get an error with this line:
set the height of field "Notes" of me to the height of this stack * (0.54 - 3 * tGap)
similar -12284
Simon
Edit: double clicking on the error should show you the line the error is on, but when I resize and it hits the error the whole IDE locks up.
Edit 2: Yes, that (0.54 - 3 * tGap) will equal a negative number e.g. 0.54 - 3 * 9 maybe you wanted it the other way round (3 * tGap - 0.54).
In the field inspector you have the option to turn on the borders of the fields. I used it so that I could watch the fields change size.
2 Things:
1) take the script out of the preOpenCard for now (until this gets solved)
2) resize by dragging the corner, not maximising the window. This is so you can watch your field and see which is getting too small.
If the IDE is locking when you open the stack then turn the messages off (little envelope in the menu bar).
Yes, on opening the stack I get an error with this line:
set the height of field "Notes" of me to the height of this stack * (0.54 - 3 * tGap)
similar -12284
Simon
Edit: double clicking on the error should show you the line the error is on, but when I resize and it hits the error the whole IDE locks up.
Edit 2: Yes, that (0.54 - 3 * tGap) will equal a negative number e.g. 0.54 - 3 * 9 maybe you wanted it the other way round (3 * tGap - 0.54).
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Confusing Error Message Generated by Object Resizing Han
Simon! You're the man!
tGap was declared and populated by a value that was already the result of multiplying the stack width by an integer, so to include it in the parentheses does indeed mess with everything. I need to just use the percentage, not the (percent x stack width) quantity, which is what the variable actually is. Very simple error, but I repeatedly overlooked it.
Thanks so much for helping me out with this!
Regards,
Phil E.
tGap was declared and populated by a value that was already the result of multiplying the stack width by an integer, so to include it in the parentheses does indeed mess with everything. I need to just use the percentage, not the (percent x stack width) quantity, which is what the variable actually is. Very simple error, but I repeatedly overlooked it.
Thanks so much for helping me out with this!
Regards,
Phil E.
Re: Confusing Error Message Generated by Object Resizing Han
Glad you got it working!
Simon

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