Skip to main content
tssee
Inspiring
July 8, 2016
Answered

Positioning panel

  • July 8, 2016
  • 2 replies
  • 3129 views

Good morning

I would like to place this on the top right panel

but the panel is always at the center

how can I do to fix this?

var win = new Window("palette", "PANEL");

win.cancel2Ok = win.add('panel', [10,495,300,540], "");

win.closeButton = win.cancel2Ok.add("button",  [10,10,280,35], "CLOSE");

win.onDeactivate = function(){

   win.update();

   };

var closeWin = false;

win.closeButton.onClick = function(){

   closeWin = true;

   win.close();

    };

win.onClose = function(){

   closeWin = true;

    };

win.show();

while(closeWin == false){

   app.refresh();

    };

This topic has been closed for replies.
Correct answer cbuliarca

You could reposition the window in the .onShow event:

var win = new Window("palette", "PANEL");

win.cancel2Ok = win.add('panel', [10,495,300,540], "");

win.closeButton = win.cancel2Ok.add("button",  [10,10,280,35], "CLOSE");

win.onDeactivate = function(){

   win.update();

   };

var closeWin = false;

win.closeButton.onClick = function(){

   closeWin = true;

   win.close();

    };

win.onClose = function(){

   closeWin = true;

    };

win.onShow = function(){

  var ww = win.bounds.width;

  var hh = win.bounds.height;

  win.bounds.x  = 10;

  win.bounds.y  = 495;

  win.bounds.width  = ww;

  win.bounds.height  = hh;

}

win.show();

while(closeWin == false){

   app.refresh();

    };

2 replies

cbuliarcaCorrect answer
Inspiring
July 8, 2016

You could reposition the window in the .onShow event:

var win = new Window("palette", "PANEL");

win.cancel2Ok = win.add('panel', [10,495,300,540], "");

win.closeButton = win.cancel2Ok.add("button",  [10,10,280,35], "CLOSE");

win.onDeactivate = function(){

   win.update();

   };

var closeWin = false;

win.closeButton.onClick = function(){

   closeWin = true;

   win.close();

    };

win.onClose = function(){

   closeWin = true;

    };

win.onShow = function(){

  var ww = win.bounds.width;

  var hh = win.bounds.height;

  win.bounds.x  = 10;

  win.bounds.y  = 495;

  win.bounds.width  = ww;

  win.bounds.height  = hh;

}

win.show();

while(closeWin == false){

   app.refresh();

    };

JJMack
Community Expert
Community Expert
July 8, 2016

Thank you Your window.onshow function seems to work.

JJMack
Participant
July 8, 2016

var win = new Window("palette", "PANEL");

this must be:

var win = new Window("palette", "PANEL", [ x, y, wd, ht ] );

where x, y, wd, and ht is the position of the new created window.

Hope this helps.

JJMack
Community Expert
Community Expert
July 8, 2016

Adobe broke that feature in its rewrite of ScriptUI. All windows are centered. Problem was reported. One reported palette windows location worked I do not find that to be right. win.frameloaction does not work for me. nor does .framebounds

frameLocation Point A Point object for the location of the top left corner of the Window’s frame. The same as [frameBounds.x, frameBounds.y]. Set this value to move the window frame to the specified location on the screen. The frameBounds value changes accordingly.

JJMack