This is a migrated thread and some comments may be shown as answers.

Window Centering Issues

0 Answers 142 Views
Window
This is a migrated thread and some comments may be shown as answers.
Shaun Peet
Top achievements
Rank 2
Shaun Peet asked on 11 Oct 2007, 06:08 PM

This is my scenario:

Splitter consisting of two horizontal panes.  The top pane is used for navigation (about 60 pixels high) and the bottom is used for content.  The bottom pane opens the windows, which are always modal and don't have a visible status bar.

When a window is opened, it is centered horizontally, but it is slightly off vertically.  So I've created a "nudge" function which nudges the window up about 30 pixels - which appears to be about the amount that the window is off by.  Seems to work quite well so far.

function get_RadWindow() {   
  var oWindow = null;   
  if (window.radWindow) {   
    oWindow = window.radWindow;   
  }   
  else if (window.frameElement.radWindow) {  
    oWindow = window.frameElement.radWindow;   
  }  
  return oWindow;  
}  
function nudgeWindow(x,y) {   
  var oWnd = get_RadWindow();   
  var bounds = oWnd.getWindowBounds();   
  var t = bounds.y;   
  var l = bounds.x;   
  oWnd.moveTo(l + x, t + y);  

Hope that helps somebody else.

No answers yet. Maybe you can help?

Tags
Window
Asked by
Shaun Peet
Top achievements
Rank 2
Share this question
or