Property .OnChanged event in VisualComponents

In Visual Components value changes of vcProperty instances trigger the OnChanged event. A custom function can be defined and assigned to this event. This also works for the Name property of vcComponent instances, i.e. components in the 3D world of a Visual Components application.

Below is an example:

pName = getComponent().getProperty("Name")

print(pName)

def whenchange(prop):
  print(prop.Value)

pName.OnChanged = whenchange

If you implement this into a script in a vcComponent property you will see that the name of the component is recognized as a vcProperty instance.

Whenever the name is changed the OnChanged event is triggered and handled by the custom whenchange function.