Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Panel position and size

Explorer ,
Dec 07, 2009 Dec 07, 2009

Is there a way to set a panel's x/y position and size using PS scripting?  If someone could point me to some documentation on this, that would be hugely appreciated!

TOPICS
Actions and scripting
571
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guru ,
Dec 07, 2009 Dec 07, 2009

If you are asking about the built-in panels, no you can not move or size them with scripting.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 07, 2009 Dec 07, 2009

Thanks for your response Michael.

Actually, to be more specific, I'm building a Flash based panel to use with Photoshop.  Not sure if this qualifies as a "built-in" panel as you mention.

What I'm looking to do is have the panel resize itself when a button within the panel is pressed.  Also, I'd like to be able to position the panel to a specific x/y location when it is opened.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Dec 07, 2009 Dec 07, 2009

I don't think you can set the position of a custom panel. It seems to open where ever it was last closed. But you can set the size.

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init()"
     paddingLeft="0" paddingBottom="0" paddingRight="0" paddingTop="0"
     verticalScrollPolicy="off" horizontalScrollPolicy="off"
     horizontalGap="0" verticalGap="1">
     <mx:Script>
          <![CDATA[
               import com.adobe.csxs.core.CSXSInterface;
               import com.adobe.csxs.events.*;
               import com.adobe.csxs.types.*;
               
               private function getGeometry():WindowGeometry {
                    var panel_X:Number = 100;
                    var panel_Y:Number = 100;
                    var panel_W:Number = windowsizebox.width + 15;
                    var panel_H:Number = windowsizebox.height + 20;
                    var windowsize:WindowGeometry = new WindowGeometry(panel_X,panel_Y,panel_W,panel_H);
                    return windowsize;
               }
               private function setSize():void{
                    var csxs:CSXSInterface = CSXSInterface.getInstance(); 
                    csxs.requestStateChange(StateChangeEvent.WINDOW_RESIZE, getGeometry());
               }
               /**
                    Function:          init
                    Description:     Initialize the panel
                                        
               */
               public function init():void{
                    try{// for skinning
                         var result:SyncRequestResult = CSXSInterface.instance.getHostEnvironment();
                         var hostData:HostEnvironment = result.data;
                         var skinInfo:AppSkinInfo = hostData.appSkinInfo;
                         var defaultColor:String = skinInfo.panelBackgroundColor.color.rgb;
                         this.setStyle("backgroundGradientColors", [defaultColor, defaultColor]);
                         this.setStyle("fontFamily", skinInfo.baseFontFamily);
                         this.setStyle("fontSize", skinInfo.baseFontSize);          
                    }catch (errObject:Error) {}
               }
          
          ]]>
     </mx:Script>
     <mx:VBox x="10" y="10" id="windowsizebox"  height="100" width="100">
          <mx:Button label="Button" click="setSize();"/>
     </mx:VBox>

</mx:Application>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 07, 2009 Dec 07, 2009
LATEST

This is perfect.  Thanks for the example Michael!  I'll give this a try.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines