10 Replies Latest reply on Jun 15, 2011 8:13 AM by Loic.Aigon

    Resize Extension creationcomplete/init

    Loic.Aigon Adobe Community Professional

      Hi all,

       

      I have a function to resize my extension. As I have different states (ans as stateManager seems buggy), I switch state and order resizing. Everything is fine except on extension loading. Whatever I try resizing on creation complete or initialization, none works.

      The weirdest is that It seems like the resizing function  is called but without any effect. On the contrary, the function works as expected later when switching from state to state.

       

      I looked into CSSDK API but it seems that CSXSWindowedApplication inherits from WindowedApplication so creationcomplete and initialization events should be ok. I tried to played with statechange events within CSXSInterface but still no luck.

       

      I can't figure out why a function works fine except on loading the extension. Is that a known issue ?

       

      TIA Loic

        • 1. Re: Resize Extension creationcomplete/init
          Loic.Aigon Adobe Community Professional

          Hi all,

           

          Sorry to give this post a fresh start but I am still stuck so I hope someone pass by and have an idea.

           

          As I introduced, I have a big issue in resizing my extension on launch.

          Given the attached image:

          demo.png

           

          I can easily resize the extension from any state to another once the extension is loaded. But if I quit extension on state 3 and require state 1 to appear on launch, it keeps the former size and non of my attempst to resize the extension to correct size worked.

           

          I tried to resize extension on initialization, on creationcomplete, on WindowComplete, WindowActivate. I tried to resize before quitting but call to my resize function on close seems helpless. Whatever I try, it's hopeless. Most irritating is that the resize function works like a charm once it's loaded but no way to resize extension on loading of after loading. It only starts working on first change of state and of course I tried this too without success.

           

          My last thought is to get back the indesign preferences file which stores the extension size and edit it on closing but I couldn't find it yet.

           

          Any advice ?

           

          private function resizeExtension(w:Number,h:Number):void{
               var winGeom:WindowGeometry = new WindowGeometry();
               winGeom.width = w;
               winGeom.height = h;
               CSXSInterface.getInstance().requestStateChange(com.adobe.csxs.events.StateChangeEvent.WINDOW_RESIZE, winGeom);
          }
          

           

          TIA Loic

          • 2. Re: Resize Extension creationcomplete/init
            zak.nelson Level 3

            Hi Loic,

             

            I am seeing the same behavior you are reporting. I have filed a bug on the issue. In the meantime, to workaround your issue, you just need to call your code a bit later. Can you try the following:

             

                protected function application1_creationCompleteHandler(event:FlexEvent):void
                {
                    var t:Timer = new Timer(1);
                    t.addEventListener(TimerEvent.TIMER,
                        function f(e:TimerEvent):void {
                            resizeExtension(300, 300);
                            t.stop();
                        }
                    );
                    t.start();
                }

             

            I realize that's not very satisfying, but I hope it at least gets you at the functionality you're aiming for.

             

            Zak

            • 3. Re: Resize Extension creationcomplete/init
              Loic.Aigon Adobe Community Professional

              Hi Zak,

               

              Thank you so much for taking the time to offer a solution. I won't be able to give it a try before Monday I think but that brings me hope.

              I don't know if it can helps but I noticed that an extension looks like unactivated at startup.

              I mean that I can get some intermediate result this way:

               

              ...windowComplete="customFunction()"...

               

              private function customFunction():void{

              alert(""); //I created a specific alert function

              resizeExtension(350,500);
              }

               

              In this example, depending on if i comment out or not the alert call, I have the extension resized or not on windowComplete.

              It's like with the alert, the extension is being activated somehow and then become resizable.

              Without alert, it stays unresized.

               

              So I imagined I could call a scriptUI dummy window and close it as soon as I show it. But with that unreasonable approach, I only have the expected result if the scriptUI window is closed by user not by the script itself. So it's pointless.Anyway this is dumb but you may feel how desperate I am

               

              Finally, if your snippet is no help, my very last hope is to get that focusOut/focusIn behaviour in order to activate the extension (this.activate() is no help) like the js alert seems to do.

               

              I keep you in touch on monday.

               

              Loic

              • 4. Re: Resize Extension creationcomplete/init
                Loic.Aigon Adobe Community Professional

                Hi Zak,

                 

                I will build a statue on your honor

                You just SAVED me. Thx a lot, your workaround fixed my issue

                Thanks a lot to Gabriel, you and your team for your really dedicated support.

                 

                Loic

                • 5. Re: Resize Extension creationcomplete/init
                  zak.nelson Level 3

                  Haha, glad to help. In case you need some inspiration: http://en.wikipedia.org/wiki/Colossus_of_Rhodes

                  • 6. Re: Resize Extension creationcomplete/init
                    Loic.Aigon Adobe Community Professional

                    ok, I leave you one hour, running to the store to build some concrete. Maybe I should warn the neighbourhood

                    • 7. Re: Resize Extension creationcomplete/init
                      Bob Stucky Adobe Employee

                      Concrete? Wouldn't marble be more appropriate?

                       

                       

                      • 8. Re: Resize Extension creationcomplete/init
                        Loic.Aigon Adobe Community Professional

                        I would offer gold if I could afford

                         

                        • 9. Re: Resize Extension creationcomplete/init
                          Harbs. Level 6

                          Not a problem.

                           

                          You can get both marble and gold very easily!

                           

                          Harbs

                          • 10. Re: Resize Extension creationcomplete/init
                            Loic.Aigon Adobe Community Professional

                            Anyway, I wanted to thank you all.

                             

                            Dirk, for giving me the instruction to get back the extension path.

                             

                            Bob, for helping me on extra folders topic to be packaged into the extension (tested with packaging jar utility and works perfect)

                             

                            Harbs, for his help on CSXSWindowApplication that open the doors towards resizing.

                             

                            And of course, Gabriel, Zak and the CSSDK crew for their final support.

                             

                            You may be pleased to know that there is a bit of each one of you in my final product

                             

                            Thank you so much for your presence.

                             

                            Loic