Jump to content

close a showModal-Form by clicking NOT in the form


Recommended Posts



has anyone a trick to close a showmodal-form by clicking beside the form ?


like a popup .. if it is visible and i click somewhere - the popup will be closed..


i open the form per:   tUniForm.ShowModal;


thanks for suggestions :-)




Link to comment
Share on other sites

Hello, can anyone help me with the Suggestion of Oliver ?


i search a piece of javascript and the step´s how to implement it to close a ShowModal Form by clicking on the "x-mask" div element ...


Thank you

Link to comment
Share on other sites

// UniForm1.script:

function setMaskeventClosewindow(target) {
var elements = document.body.getElementsByTagName('div');
for (var i = 0; i < elements.length; i++) {
if (elements[i].className.indexOf('mask') != -1) {
elements[i].onclick = function() {target.close();};

// UniForm1.onShow:

procedure TuniForm1.UniFormShow(Sender: TObject);
UniSession.AddJS('setMaskeventClosewindow(' + self.WebForm.ExtWindow.JSName + ');');

// call in MainForm:



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...