Skip to main content
August 6, 2009
Question

[ScriptUI] Position of Window (dialog)?

  • August 6, 2009
  • 1 reply
  • 2931 views

Even when I think it's not possible I'm curious if I'm right:

Is there a way to set the location of a new window depending on the current selection?

Why?

... I want to spread the zoom to the page and want to make sure the dialog never hides the selection.

H.

This topic has been closed for replies.

1 reply

Bob Stucky
Adobe Employee
Adobe Employee
August 6, 2009

var p = new Window( "palette", "Show Me" );

p.add( "statictext", undefined, "How to move a window" );

// frameLocation is set by an array [ x, y ]

p.frameLocation = [ 250, 100 ];

p.show();

That'll set the window location. Now to figure out where it goes, you'll need to look at window.bounds and selection[ index ].geometricBounds to figure out how not to cover the selection.

Bob

Steven__
Inspiring
August 13, 2009

While its possible to figure that the top left corner shouldn't cover the text, its not possible to figure what the width and height of the dialog is going to be after Adobe's layout engine lays out dialog. because the layout is only complete when window is shown, and when dialog is shown it's modal not giving the scripter the opportunity to move it.

Tell me if I'm wrong, but this was the result of my testing.

Steven

Bob Stucky
Adobe Employee
Adobe Employee
August 13, 2009

Check the Window.onShow() callback. While I don't have the time to test it at the moment, I believe the full geometry is ready during that callback, and you can make modifications to the layout and position.

I'll check it tomorrow; but, I'm fairly certain about this.