Regarding closing a pop window


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Regarding closing a pop window

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Location
    secret!!!
    Posts
    2

    Question Regarding closing a pop window

    hi,
    I am having an application in VB .NET, which has many links to a pop window .... this window comes from the backend java script ... the javascript is shown here
    this function might look too long but it has defines the size for many other pop up windows. now if i close my application , the applcation is getting closed but these pop ups are not closing. Appreciated if anyone gives suggestions or coding techniques.



    function winPopUp(strUrl,strWinSize)
    {
    var strWindSize = strWinSize.toUpperCase();
    var windowWidth; // window width
    var windowHeight;// window height
    if (strWinSize == 'OR')//Large window - used for Order Information For Run Popup
    {
    windowWidth = 925;
    windowHeight = 350;
    }
    if (strWinSize == 'XXXL')//Small window - used for Change Printer Popup
    {
    windowWidth = 320;
    windowHeight = 210;
    }
    if(strWinSize == 'XXL') // Extra large window - used for QTE details
    {
    windowWidth = 700;
    windowHeight = 400;
    }
    if(strWinSize == 'XL') // Extra large window - used for Pallet details
    {
    windowWidth = 400;
    windowHeight = 275;
    }
    if(strWinSize == 'N') // Extra large window - used for USER details
    {
    windowWidth = 600;
    windowHeight = 500;
    }

    if(strWinSize == 'L') // large window - used for Master roll details
    {
    windowWidth = 700;
    windowHeight = 480;
    }

    if(strWinSize == 'M')// medium window - used for Order details
    {
    windowWidth = 710;
    windowHeight = 290;
    }

    if(strWinSize == 'S')// small window - used for slit roll details
    {
    windowWidth = 680;
    windowHeight = 390;
    }
    if(strWinSize == 'SH') //very large window - used for Slit Roll Hardness Test
    {
    windowWidth = 900;
    windowHeight = 500;
    }
    if(strWinSize == 'V')// View window - used for View User details
    {
    windowWidth = 400;
    windowHeight = 400;
    }


    var windowToPositionX=window.event.clientX; //client x co-ordinate
    var windowToPositionY=window.event.clientY; //client y co-ordinate
    var windowTop = window.screenTop
    //If window display exceeds screen right
    //Modified the code to display within the screen limits.
    if((windowToPositionX + windowWidth + 6) > screen.width)
    {
    //Negate window width with screen width which returns an X co-oridinate.
    //Add the co-ordinate with 30 just to avoid the positioning of window in
    //scrollbar.
    windowToPositionX=screen.width - (windowWidth + 30);
    //Add the Y co-ordinate to 10 to avoid the overlapped display of
    //window on date control text box.
    windowToPositionY=windowToPositionY + 10;
    }
    //If window display exceeds bottom screen.
    //Subtraction of 100 with screen height is to eliminate explore statusbar,window explore bar etc.,
    if((windowToPositionY + windowHeight + 170) > (screen.height))
    {
    //Negate Y co-ordinate with (window height + 48). Negating along with 48
    //is to avoid the overlapped display of window on date control text box.
    windowToPositionY=windowToPositionY - windowHeight - 48;
    }
    //var strWinStyles

    if(strWinSize == 'V')
    {
    var strWinStyles = "top=" + parseInt(window.screenTop + windowToPositionY) + ",left=" + windowToPositionX + ",width=" + windowWidth + ",height=" + windowHeight + ",menubar=no,resizable=no,scrollbars=yes,toolbars=no,modal=yes";
    //var strWinStyles = "dialogTop: " + parseInt(windowTop + windowToPositionY) + "px;dialogleft: " + windowToPositionX + "px;dialogWidth: " + windowWidth + "px;dialogHeight: " + windowHeight +"px;center: 0;resizable: 0;edge: sunken;scroll: no;"
    // var strWinStyles = "dialogTop: " + parseInt(windowTop + windowToPositionY) + "pt;dialogleft: " + windowToPositionX + "pt;dialogWidth: " + windowWidth + "pt;dialogHeight: " + windowHeight +"pt;center: off;resizable: 0;edge: sunken;scroll: no;"
    }
    else
    {
    var strWinStyles = "top=" + parseInt(window.screenTop + windowToPositionY) + ",left=" + windowToPositionX + ",width=" + windowWidth + ",height=" + windowHeight + ",menubar=no,resizable=no,scrollbars=yes,toolbars=no,modal=yes";
    }
    view_window=window.open(strUrl,'ViewDetails',strWinStyles);
    //var view_window = window.showModalDialog(strUrl,"",strWinStyles);
    view_window.focus();
    return false;
    }

    function MM_popupMsg(msg)
    {
    //this.alert(msg);
    this.confirm(msg);
    }


    function GoBack()
    {
    history.go(-1);
    }

    function ResetFormControls()
    {
    document.frmMain.reset();
    }

    function CheckKey(sCtrlName)
    {
    if(window.event.keyCode==13)
    {
    event.returnValue=false;
    event.cancel = true;
    var btn = document.getElementById(sCtrlName);
    btn.click();
    }
    return true
    }


    thanks anr regards
    Usha
    jeeju

  2. #2
    Join Date
    Feb 2006
    Location
    Faridabad, Haryana (India)
    Posts
    12
    Dear Usha,

    It will be better if you showModalDialog method of window instead of Open method because showModalDialog method will control the focus and does not allow user to close parent window until and unless pop up open through showModalDialog is not closed.
    Enjoy,

    Gurdarshan Singh
    L.S.E. (Project Lead)
    InterGlobe Technologies Pvt. Ltd.
    Mobile #: 9891397798 (India)
    gurdarhan.singh@interglobetechnologies.com
    gurdarshan70@hotmail.com

    Always Think Positive whatever may be the Situation.

    Please rate my suggestion/response if you find it suitable or fulfill your requirement.

Similar Threads

  1. Closing Window with Javascript
    By John in forum Java
    Replies: 1
    Last Post: 02-19-2002, 08:52 PM
  2. child window - is it or isn't it?
    By TC in forum VB Classic
    Replies: 8
    Last Post: 09-26-2000, 03:34 AM
  3. child window - is it or isn't it?
    By TC in forum VB Classic
    Replies: 0
    Last Post: 09-25-2000, 10:06 AM
  4. Closing a window when you only have the Title
    By Brent in forum VB Classic
    Replies: 12
    Last Post: 05-03-2000, 01:25 PM
  5. Closing a window when you only have the Title
    By Brent in forum VB Classic
    Replies: 0
    Last Post: 05-01-2000, 11:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center