Hide custom popup when clicking outside

Version 4.0.3

I have a popup attached to a cell in the grid. It opens instead of a standard editor. The popup has 2 buttons: OK and Cancel, both work as expected. Esc key hides the popup (OOTB functionality).

var popup = new dhtmlXPopup();
popup.attachForm([ ..... ]);

When I click outside of the popup it still stays visible. It is especially problematic as the grid is in a tab and clicking another tab leaves the popup visible.

Is there an easy way of hiding this kind of a popup whenever I click outside of it?

Hi

please provide completed demo including all corresponmding js/css files. if your version is pro then please send it to support@dhtmlx.com (direct link also an option).

I have the same problem. Is there a solution?