Page 1 of 1
Dynamic Objects Not Positioning Correctly
Posted: Mon Aug 20, 2012 10:24 pm
by xclntdesign
I am creating 2 objects dynamically based on data: a field and a button. I am creating them inside an existing group.
For reasons unknown, the new objects are ignoring the commands I am using to set the top and left of the object for positioning. I know the syntax is correct.
Code: Select all
set the top of field newField of stack myStack to 479
set the left of field newField of stack myStack to 128
When I enter the correct left and top positions in the Property Inspector and save the stack, the objects jump right back to the original, incorrect position.
I have checked the objects and there is no geometry being set.
Any ideas?
Re: Dynamic Objects Not Positioning Correctly
Posted: Mon Aug 20, 2012 10:31 pm
by shaosean
You mentioned that the controls are being created in the group.. Do you have the
lockLocation property of the group set to true?
Re: Dynamic Objects Not Positioning Correctly
Posted: Tue Aug 21, 2012 1:13 am
by xclntdesign
I've tried it both ways, on and off, set before and after the positioning controls. Didn't seem to make a difference.
The default I'm using is set lockloc to false.
Re: Dynamic Objects Not Positioning Correctly
Posted: Tue Aug 21, 2012 3:07 am
by shaosean
Another quick question.. Is "newField" the actual name of the field or a name of a variable you are using? If it is either of those, it is a reserved word..
newField message
newButton message
Re: Dynamic Objects Not Positioning Correctly
Posted: Tue Aug 21, 2012 1:34 pm
by xclntdesign
That's just an example I was using. The actual variable names were newFieldName and newGraphicName.
Re: Dynamic Objects Not Positioning Correctly
Posted: Tue Aug 21, 2012 2:13 pm
by shaosean
Any chance to peek at the actual stack? The sample code you posted should work, but you stated that even doing it through the Inspector caused the controls to revert to their previous locations..
Re: Dynamic Objects Not Positioning Correctly
Posted: Tue Aug 21, 2012 2:38 pm
by xclntdesign
Here's the section that's giving me grief. The names of some variables have been changed to protect the innocent.
In a nutshell: The script steps through an array of appointments, and creates a text field in a specific location with the appointment info, and a transparent button on top of that field so that the appointment can be acted upon (get details, edit, delete, etc).
The button appears in the right place for some reason, the text field does not.
Re: Dynamic Objects Not Positioning Correctly
Posted: Tue Aug 21, 2012 7:23 pm
by shaosean
*sigh* Sorry, I forgot to mention about saving it in the legacy stack format.. I never upgraded to LiveCode due to moving to other languages..
Re: Dynamic Objects Not Positioning Correctly
Posted: Tue Aug 21, 2012 8:13 pm
by xclntdesign
Saved this one as 2.7.
Re: Dynamic Objects Not Positioning Correctly
Posted: Tue Aug 21, 2012 10:15 pm
by shaosean
coding errors on this line
Code: Select all
put ceiling(currentAppointment[3]]) / .5) into calendarDuration
should(?) be
Code: Select all
put ceiling(currentAppointment[3] / .5) into calendarDuration
Re: Dynamic Objects Not Positioning Correctly
Posted: Tue Aug 21, 2012 10:21 pm
by shaosean
Sorry, but there are too many un-intialized variables and apparently a missing stack.. If you would like we can remote screen share and I can help you out on your computer (I am sure someone I have done this with in the past will vouch for me
