Flex widgets retrieving with Pro Code

Hi there,
I am trying to retrieve widgets placed in a flex container via Pro Code from outside the code written in the controller.
So, I add some components in a Flex Container with this code in the form controller:
'
const selectedComp = new ki.luxottica.selectedComponentwithContract({
id: `channel{index}${new Date().getTime()}`,
width: '100%',
height: '100%',
centerX: '50%',
centerY: '50%'
}, {}, {});
this.view.flxLeftSide.add(selectedComp);
'
After that, if I do:
content = this.view.flxLeftSide.widgets();
voltmx.print(JSON.stringify(content));
I got:
Uncaught TypeError: Converting circular structure to JSON
But if I do:
voltmx.print(content);
I got:
[object Object],[object Object],[object Object],[object Object],[object Object]
I would like to retrieve the reference to this objects in order to set them visible or non visible in some cases.
Could you please help me? I'm not finding the right solution

Hi @Eugenio Carpentieri

What's the value of voltmx.print(typeof content);

Hi,

thanks for the reply.

The value of voltmx.print(typeof content); is:

### TYPE OF CONTENT: object

The call this.view.flxLeftSide.widgets() returns the array of child widgets of flxLeftSide. If you want to set them all, let's say, visible, you need code like this:

this.view.flxLeftSide.widgets().forEach((widget) => widget.isVisible = true);

ciao
Mario

Many thanks!!

Have a nice day :)