Get Component in the Shared library script

Hi all,

Is there a way to get a component from the Shared library script?

If we do component scripting, for instance, we could get any component from the parent window by

event.source.parent.getComponent('your component name')

How about getting a component from the shared script library? Anything that can substitute “event.source.parent”?

It depends on how you called the shared script. If you are calling it from an event from a component, just pass the event variable to the shared script as a function argument. Then use event.source normally. Otherwise, you’ll need to use getWindow() like:w = system.gui.getWindow('your window name') component = w.rootContainer.getComponent('your component name')It’ll fail if the window isn’t opened, though, and will randomly select a matching window if multiple instances were opened.

I see… So, it is possible but the limitation is whether the window is opened or not. Thanks!