Need help accurately positioning form in dialog

I am trying to show a formInDialog in a particular place on the screen based on the location of element. I can account for the window position of the main window in case the user has moved the window, and I can add the width of my controller to the X position, but the presence or non-presence of toolbars is messing up my Y position.

Is there some way to get the screen location of an element, not just its form location?

Steve in LA

Lets do some advanced stuf :)

var x = elements.test.getLocationX();
var y = elements.test.getLocationY();
var point = new java.awt.Point(x,y);
Packages.javax.swing.SwingUtilities.convertPointToScreen(point,elements.test);

Too advanced for me. I’ll have to become much more fluent in Java before things like this make sense to me. No worries, though since I already found a way around my immediate problem.

Thanks.

Added

  • getScreenX(element) and
  • getScreenY(element)

to the tools plugin. Will be available later this week :)

you can do this:

//calculate the new x coordinate of the dialog
var x = plugins.it2be_tools.getScreenX(elements.button) - elements.button.getLocationX();

//calculate the new y coordinate of the dialog
var y = plugins.it2be_tools.getScreenY(elements.button) + elements.button.getHeight() - elements.button.getLocationY();

application.showFormInDialog( forms.test2, x, y, -1, -1, ‘Test’, false,false,true);

Marcel - AWESOME!

Johan - THANKS - very cool!

Marcel == The Man!

Thank you very much. Your feature worked like a charm.

Steve in LA

Thanks for the compliment

BTW when you say this you are checking if I am The Man ;)

Marcel == The Man!

Not sure yet
:D