2 Replies Latest reply on Mar 26, 2013 10:08 AM by KennethWebb

    Is it possible to script a tabbed ui?

    Damienned

      Is it possible to script a tabbed ui like this, i can't seem to get it to work, please help...

       

      Cheers Daniel.

       

       

      My script for now:

       

      #target illustrator

      tabbed_ui();

       

      //Functions

      function tabbed_ui(){

         

          res =

          "dialog {text:'Adres database:', properties:{resizeable:false }, \

              maintabpanel: TabbedPanel { text:'', \

                  subtab1panel: Tab { text:'Tab1', \

                  }, \

                  subtab2panel: Tab { text:'Tab2', \

                  }, \

              }, \

          }";

         

          wininfo = new Window (res);

          wininfo.frameLocation = [100, 100];

          wininfo.margins = 0;

         

          // Control Escape key

          wininfo.addEventListener('keydown', function (k) { 

              if (k.keyName == 'Escape') {

                  wininfo.close();

              }

          });

       

          wininfo.center();

          wininfo.show();

      };

        • 1. Re: Is it possible to script a tabbed ui?
          moluapple Level 4

          Resource string not work here, but regular code will work.

          var w = new Window ("dialog", "Adres database:");
          var tpanel = w.add ("tabbedpanel");
          var subtab1panel = tpanel.add ("tab", undefined, "Tab1");
          var subtab2panel = tpanel.add ("tab", undefined, "Tab2");
          w.show();
          

          Since resource-based style is hard to debug, you'd better always use code-based style.

          • 2. Re: Is it possible to script a tabbed ui?
            KennethWebb Level 1

            Resource strings do work with tabbed panels, you just have to call it out as a panel and set its "type:" to "tabbedpanel", and to create tabs you create new Panels as children and call out their "type:" as "tab".

            Link to thread that explains this.

             

            Res code that will work for you:

             

            res =

                "dialog {text:'Adres database:', properties:{resizeable:false }, \

                    maintabpanel: Panel { type: 'tabbedpanel', \

                        subtab1panel: Panel { type: 'tab', text:'Tab1', \

                        }, \

                        subtab2panel: Panel { type: 'tab', text:'Tab2', \

                        }, \

                    }, \

                }";