Event for initialization?

I’m trying to find some way to set up a component’s properties with a script but there is no event for Initialization which doesn’t make sense???

1 Like

Use this on the propertyChange script of the component:

if event.propertyName == "componentRunning" and event.newValue:
	#component initialization here

Note that this works in the Ignition client (where it matters) and not in the Ignition designer. So you need to test this in the Ignition client, not the designer. I do most of my testing in the client anyways.

You can also put various component initialization code in the visionWindowOpened event on your window. Generally if you need to configure multiple components then it is good to put logic in one script rather then spread out in different places, in my opinion.

3 Likes

Thank you so much the visionWindowOpened event will be very useful. I must have been checking the root container for events as opposed to the window!

1 Like