showPopup

Bugs in showPopup

I've been tearing my hair out because showPopup() doesn't aways position a popup correctly. (When you use screen coordinates the popup very occasionally appears in a random place).

If you are relying on showPopup you might want to read these bugs:

Good luck! --Hamstersoup 23:42, 28 February 2007 (PST)


Needs Technical Review

NeedsTechnicalReview because the mention of the popupanchor and popupalign attributes appear only here in text (so far), and not in any of the attribute lists I've seen at this point.

The attributes appear to exist, not sure why they are not documented on XULPlanet. --Nickolay 11:30, 15 June 2006 (PDT)

popupanchor and popupalign are deprecated in favour of the position attribute. -- Enn

After trying the position attribute it becomes apparent that it has no effect when either when using showPopup() or the standard mouse over way --The Hunter 12:43, 29 March 2007 (PDT)

==

This method needs to be rewritten to account for the notes above.


Purpose of the element argument?

If you use screen coordinates rather than relative positioning then what function does the element argument have?

In the example below I use document.documentElement without really understanding why.

Thanks for any clarification!

--Hamstersoup 07:01, 22 February 2007 (PST)

Simple example of using showPopup() to position a tooltip beside the mouse

<?xml version="1.0"?>
<window onmousemove="onMouseMove(event);"
xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul">
<script type="text/javascript">
function onMouseMove(e) {
  var tooltip = document.getElementById('mouseTooltip')
  tooltip.firstChild.value=e.screenX+','+e.screenY;
  tooltip.showPopup(document.documentElement,e.screenX,e.screenY,'tooltip',null,null);  
}
</script>
<label value="Mouse the mouse around!"/>
<tooltip id="mouseTooltip" ><label /></tooltip>
</window>