I’m seeing an unusual issue with scripting. I have the following script on property change that runs as expected under the designers preview mode but when I launch the project the repeater shrinks into nothingness. The Template Repeater layout is set to Relative during the issue and the issue does not occur when the layout it is set to Anchored. This similarly happens with a Label so it is not limited to the Repeater
In the projects diagnostics console, the event continually triggers but nothing to tell the repeater to constantly get smaller.
I would appreciate any help that can be offered.
On a side note, I also can’t put the projects diagnostics console into scroll lock mode.
On another side note, the projects diagnostics console also throws an errors if you lead a print statement with str(), such as:
print str(event.source) + "Main Object"
print " " + str(event.source) + "Main Object"
Ignition Platform 7.9.6
OPC-UA Module 4.9.6
Reporting Module 4.9.6
Alarm Notification Module 4.9.6
Vision Module 9.9.6
SQL Bridge Module 8.9.6
Java Version: Oracle Corporation 1.8.0_161
Is that your entire script? No check for a particular propertyName? If you don’t check for specific property names, you will create infinite recursion. Probably not happening in the designer because the designer doesn’t do any component scaling like the client.
Thank you for a quick reply.
I have simplified it for testing down to the example given in the system.gui.transform documentation.
Here is the full code:
posX = event.source.parent.ConveyorLength
boxWidth = (100*posX)-31
count = int(round(boxWidth/36))
event.source.repeatCount = count
print " " + str(event.source.width) + " Links"
Either way, the issue still occurs as even if I stop the reoccuring trigger the object gets smaller and smaller everytime the window size is adjusted.
Would be easier if every object had a width and height property in order to use an expression
I found a work around to what is happening.
I had to specify all positioning and size attributes for some reason as they are changing somehow. This obviously works differently then objects with width and height properties that can get set by expressions as the other elements in my template have no issues.
system.gui.transform(component=event.source, newWidth=boxWidth, newHeight=10, newX=14, newY=26)
as well of course code to stop it from continually triggering.
You MUST check for a propertyName that triggers your code! Something like:
if event.propertyName == 'someTriggerProperty':
Otherwise the transform will change some properties which will recurse back into this event, making this event call itself infinitely. Or put the code in some other event that happens when you want the transform.
Yes, thank you, I have noted your point and have added an IF statement, but that didn’t fix the root issue as I indicated, the object was still changing x position, y position, and height every time the window size was adjusted and the script triggered even though those values were not told to change in the script.
What is it you are transforming? Working on a template right now where I need to transform a rectangle. This resulted in strange behavior, however wrapping it in a container and transforming that instead, solved my issue.
As a side note, I’ve had the same issue transforming template instances, much better wrapping it in a container.
With relative layout, x, y, width, and height are not the designer sizes but the runtime sizes in the client, so they are changing. The designer sizes are not available in the client (at least, not conveniently, and not supported).