def setPopupPosition(self, left, top): if isinstance(left, basestring): if left.endswith('%'): left = int(left[:-1]) left = int(left * Window.getClientWidth() / 100) elif left.lower().endswith('px'): left = int(left[:-2]) if isinstance(top, basestring): if top.lower().endswith('%'): top = int(top[:-1]) top = int(top * Window.getClientHeight() / 100) elif top.endswith('px'): top = int(top[:-2]) left = max(left, 0) top = max(top, 0) # Account for the difference between absolute position and the # body's positioning context. left -= DOM.getBodyOffsetLeft() top -= DOM.getBodyOffsetTop() element = self.getElement() DOM.setStyleAttribute(element, "left", "%dpx" % left) DOM.setStyleAttribute(element, "top", "%dpx" % top)
def setPopupPosition(self, left, top): if left < 0: left = 0 if top < 0: top = 0 # Account for the difference between absolute position and the # body's positioning context. left -= DOM.getBodyOffsetLeft() top -= DOM.getBodyOffsetTop() element = self.getElement() DOM.setStyleAttribute(element, "left", "%dpx" % left) DOM.setStyleAttribute(element, "top", "%dpx" % top)