WebDialogBox - few question

3 replies. Last post: January 2, 2014 8:40 PM by Bernard Xiang
Tags :
  • (None)
roi ukashiMember
Hi all, 

few question regarding WebDialogBox:

  1. How do I keep the WebDialogBox static (prevent user from moving it on the screen).
  2. If user moves the WebDialogBox to the top of the screen, it could get stuck, without the ability to move it downwards again. How do I prevent it from getting stuck?
  3. Is it possible to use "AllowMinimize" without integrating the WebDialogBox with a WebDesktop?

That's all for now :-)


Answers

Hi Roi,

For the issue number 1 and 2, you can solve this issue by attaching onmouseup event when dialogbox created on client side. In OnCreated event, you could add onmouseup event of frame element of dialogbox.

Here's the snippet code:

function OnCreated(controlId) {
    var dlgBox = ISGetObject(controlId);
    dlgBox.Window.GetWindowDivElement().onmouseup = function () { CheckLocation(); };
}
function CheckLocation() {
    var dlgBox = ISGetObject('WebDialogBox1');
    //prevent webdialogbox header missing when dragged to top
    if (dlgBox.Window.GetWindowDivElement().style.top.indexOf('-') != -1) {
        dlgBox.Window.MoveTo(parseInt(dlgBox.Window.GetWindowDivElement().style.left.replace('px', '')), 0);
    }
    //prevent move by move it to the center after move
    dlgBox.Window.MoveToCenterDesktopAbsolute();
}

Although it's not possible to allow minimize in your WebDialogBox when not integrated with WebDesktopManager because WebDialogBox and WebDesktopWindow has different behavior. So to achieve minimize scenario, there are no other way than integrate your WebDialogBox to WebDesktopManager. Hope this helps.

Regards,
Bernard

All Replies

Hi Roi,

For the issue number 1 and 2, you can solve this issue by attaching onmouseup event when dialogbox created on client side. In OnCreated event, you could add onmouseup event of frame element of dialogbox.

Here's the snippet code:

function OnCreated(controlId) {
    var dlgBox = ISGetObject(controlId);
    dlgBox.Window.GetWindowDivElement().onmouseup = function () { CheckLocation(); };
}
function CheckLocation() {
    var dlgBox = ISGetObject('WebDialogBox1');
    //prevent webdialogbox header missing when dragged to top
    if (dlgBox.Window.GetWindowDivElement().style.top.indexOf('-') != -1) {
        dlgBox.Window.MoveTo(parseInt(dlgBox.Window.GetWindowDivElement().style.left.replace('px', '')), 0);
    }
    //prevent move by move it to the center after move
    dlgBox.Window.MoveToCenterDesktopAbsolute();
}

Although it's not possible to allow minimize in your WebDialogBox when not integrated with WebDesktopManager because WebDialogBox and WebDesktopWindow has different behavior. So to achieve minimize scenario, there are no other way than integrate your WebDialogBox to WebDesktopManager. Hope this helps.

Regards,
Bernard

Bernard Hi, 


For some reason the GetWindowDivElement() is  null when OnCreated fires. 

I had to use this call  dlgBox.Window.GetWindowDivElement().onmouseup = function () { CheckLocation(); };

only after .ShowDialog();

 Anyhow, that did the trick.

 
Thanks.

Hi Roi,

That should do the trick also because WebDialogBox will be created during ShowDialog and you could add the mouseup handler in there. Hope this helps.

Regards,
Bernard

All times are GMT -5. The time now is 7:09 PM.
Previous Next