Count Numbers of popup open on a view

Hello, I have a view where I have many webcams. The PopupId is diferent for each webcam.
When I click on each webcam, a popup is open. The problem is if I click on 10 webcams, that is mean 10 popup will be open.
But what client want is: the number of popup that can be open on the screen is 3.
What does that mean I need count a numbers of popup open before open another popup.

is possible to count the numbers of popup opened?

Make wrapper functions around system.perspective.openPopup and system.perspective.closePopup that increment/decrement or add/remove the popup id on a session custom property, then use that property.

I initialise a variable varCount on Sessions to increment when I open the popup. But I don't know how can detect event, what close popup to decrment varCount because I haven't define a button to close Popup.
I close Popup when I click on the x of Popup

Ignition probably keeps a list of open popups ids somewhere, I'm not sure where to find it though...

Maybe they appear in the pageIds array you get from system.perspective.getSessionInfo ?

1 Like

Hello, I found the solution:
I create an CountPopup CUSTON on my SESSION. I initialise it to 0.

when I open popup, CountPopup = CountPopup +1

And I put a script to onShutDown event of my root popup

When Popup is closed , CountPopup = CountPopup -1

it work but I don't know if it is a best solution