Unsolved Can't set popup x, y before showing
-
I have a menu item from which I am opening a popup with a known id. I am wanting to incorporate some logic to adjust the popup position. In in my menu item handler, if I print the popup's
x
andy
, they are both 0. If I assign nonzero values to bothx
andy
in the same handler and print again, they are still both zero. In other code, I have previously been able to set popup coordinates before opening. Does anyone have any idea what might be going on? -
Hmmm. I have reproduced this now in a small test app. It looks like the values I set
x
andy
to are in fact respected when the popup is shown but any attempt to examine the values will show them as zero. They are still zero in anonAboutToShow
handler I added to the popup, but show the expected values in anonOpened
handler.I guess this means that care must be taken to avoid code like this:
popup.y = yUsual; // the 'usual' y value var yDelta = calculateAdjustment(); // adjustment if needed popup.y += yDelta;
since presumably this will leave
popup.y
atyDelta
rather thanyUsual+ yDelta
.