0 Replies Latest reply on Oct 2, 2012 10:15 AM by Toto RoToTO

    CSXSWindowType.PANEL + Menu

    Toto RoToTO Level 3

      Hi,

       

      I have got some troubles using panels, menus.

      Actually, from my main Illustrator extension, I just need to create a new view and then try to set a menu, as follow:

       

       

      Here is the method which is in charge of that in my extension:

      (Parsley is used.)

       

      public function createMyNewView():void

      { 

                                                   var dynamicObject:DynamicObject = context.createDynamicObjectByType(MyNewView);

                                                    var MyNewViewInstance:MenuSwatch = dynamicObject.instance as MyNewView;

       

                                                   MyNewViewInstance.type = CSXSWindowType.PANEL;

                                                   MyNewViewInstance.width = 600;

                                                   MyNewViewInstance.height = 600;

                                                   MyNewViewInstance.title = "Export selection file name";

                                                   MyNewViewInstance.showStatusBar = false;

                                                   MyNewViewInstance.open();

        }

       

      So, at this stage, MyNeView is instanciated correctly.

       

      Just after creation, I try to set Menu. And Since this is a Panel (CSXSWindowType.PANEL), I try to use the method described here:

      http://cssdk.host.adobe.com/sdk/1.0/docs/WebHelp/programmers_guide/customizing_the_ui.htm

       

      For information, here is the code of MyNewView class:

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

      <mx:Window xmlns:mx="http://www.adobe.com/2006/mxml"

                             xmlns:parsley="http://www.spicefactory.org/parsley"

                             width="600"

                             height="600"

                             layout="absolute"

                             creationComplete="creationCompleteHandler(event)"

                             >

       

      <parsley:Configure/>

       

      <mx:Script>

                          <![CDATA[

                                    import com.adobe.csxs.core.CSXSInterface;

                                    import com.adobe.csxs.core.CSXSWindowedApplication;

                                    import com.adobe.csxs.events.*;

                                    import com.adobe.csxs.events.CSXSEvent;

                                    import com.adobe.csxs.events.MenuClickEvent;

                                    import com.adobe.csxs.events.StateChangeEvent;

                                    import com.adobe.csxs.types.CSXSWindowType;

                                    import com.adobe.csxs.types.SyncRequestResult;

       

                                    import mx.events.FlexEvent;

       

       

       

                                    protected function creationCompleteHandler(event:FlexEvent):void

                                    {

                            //Menu management

                                                   var xmlMenu:XML = new XML(

                               "<Menu>" +

                              "<MenuItem Id='item_1' Label='toto'/>" +

                              "<MenuItem Label='toto'/>" +

       

                              "<MenuItem Label='toto'/>" +

                              "</Menu>");

       

                             CSXSInterface.instance.addEventListener(MenuClickEvent.FLYOUT_MENU_CLICK, menuClickHandler);

       

                             var menuAdded:SyncRequestResult = CSXSInterface.getInstance().setPanelMenu(xmlMenu);

       

                            if (SyncRequestResult.COMPLETE != menuAdded.status)

                           {

                                   _logger.error("Unable to add menu");

                           }

       

                                    }

       

                                    public function menuClickHandler(event:MenuClickEvent):void

                                    {

       

                                                   switch (event.menuName)

                                                   {

                                                                  case "toto":

                                                                            break;

       

                                         default:

                                                                            break;

                                                   }

                                    }

       

                          ]]>

       

      </mx:Script>

       

      </mx:Window>

       

      But, as a result, the only thing I have achevied to do is to set the menu of my main extension. Which is pretty normal as the method CSXSInterface.getInstance()

      is the entry point of CSXSInfrastructure.

       

      So, my question is how could I set correctly both of my menus (main extension + myNewView)?

       

       

      ps: I have tried to used NativeMenu and other solutions, nothing seems to work.

       

      So any help would be appreciated.

       

      Thanks,

      Thomas.