4 Replies Latest reply on Jun 23, 2014 3:19 PM by Jump_Over

    frozen overflows

    Jump_Over Level 5

      Hi,

       

      Could you help me to find a reason of this effect:

      myTable is 4 cells table - all with some text contents.

      First - I set every cells width to 6pt (all overflows) and second - i try to grow width till overflows is true.

      If I run this loop as a part of bigger code - it is a neverending loop.

      Alert show me cell width step by step, and even it is bigger then the content needs - overflows keeps value: true.

      If I stop script (is started from ESTK) - overflows is false.

       

      If I run this loop as a separate part of code - everything is OK.

      .....

      for (var k = 0; k < myTable.cells.length; k++)

           {

                  do {

                     myTable.cells[k].width ++;

                     alert (k + ": " + myTable.cells[k].width + ": " + myTable.cells[k].overflows);

                       }

                  while (myTable.cells[k].overflows);

           }

      .....

       

      where should I look for mistake if this overflow property's seems like frozen?

        • 1. Re: frozen overflows
          TᴀW Adobe Community Professional & MVP

          Are you sure you can do myCell.width++ ? Maybe you should be more

          cautious and do myCell.width = myCell.width + 1

           

          Just a thought. Haven't tested it.

           

          Ariel

          • 2. Re: frozen overflows
            Jump_Over Level 5

            if I cut this code as a separated part - width++ works fine.

            if I change  width++  to  width = width+1   neverending loop stay in bigger code

            • 3. Re: Re: frozen overflows
              Laubender Adobe Community Professional & MVP

              @Jarek – I know this is an old one, and in the last two years, I hope you found out to solve this problem.
              But if not, you could try to recompose every cell after changing the width.

               

              (I had the same problem today and finally got a workable solution )

               

              I also added a show stopper counter to end the while loop. First test with and then without it…

               

              var myTable = app.selection[0];
              var showStopper = 0;
              
              myTable.cells.everyItem().width = 6;
              
              for (var k = 0; k < myTable.cells.length; k++){
              
                  do{
                      showStopper++
              
                      myTable.cells[k].width ++;
                      myTable.cells[k].recompose();
              
                      $.writeln(k + ": " + myTable.cells[k].width + ": " + myTable.cells[k].overflows);
              
                      }
              
                  while(myTable.cells[k].overflows && showStopper<1000);
              
                  };
              

               

              Uwe

              • 4. Re: frozen overflows
                Jump_Over Level 5

                Hi Uwe,

                 

                Thx for your reply. Right, recompose() can kick this back to live and it is a solution.

                My solution from those days was to create a function to calculate proper width (endHorizontalOffset, horizontalOffset of text and left/rightInset of cell used).

                 

                Jarek