How to limit the number of pop ups in a window

Created by Ybone Hernandez, Modified on Thu, 08 Jul 2021 at 09:05 AM by Ybone Hernandez

Pop up displays are useful to show detailed information of some installation, machine, etc. But sometimes it is useful to limit the number of open pop ups in a window, so we can avoid overloaded screens. To do that in atvise, follow the next 2 steps:


1. Use a Simple Dynamic to open your pop up window whenever you click something in the current screen.


2. Open the Code Editor, search the previous Simple Dynamic code and add the next logic (in bold) to limit the number of open pop up windows to 5:


webMI.addEvent("id_0", "click", function(e) {
var id = "id_0";
var value = true;

var maxC =5;
var Count = top.document.querySelectorAll("#popup_main").length;
if (Count < maxC)
    webMI.display.openWindow({display:"SYSTEM.LIBRARY.PROJECT.OBJECTDISPLAYS.iframe",extern:false,height:500,menubar:false,modal:false,movable:true,resizable:false,scrollbars:false,status:false,title:"",toolbar:false,width:500,query:webMI.query});

else
    alert("Popup number has exceeded "+maxC);
});

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article