4 Replies Latest reply on May 17, 2016 3:00 AM by UQg

    How do I script a dialog box to display information?

    Schmaltzkopf Level 1

      Hi, there.

      I would like to script a dialog box that contains 7 rows and 2 collumns in which to display info as such:

      How do I do that?

       

      Any help would be appreciated.

        • 1. Re: How do I script a dialog box to display information?
          UQg Level 4

          ScriptUI doesnt have tables, the closer you can get is using a listbox. Depending on the version of your app, the lines will be drawn or not but i dont think you can control it.

           

          var w = new Window("dialog", "test");
          var lb = w.add("listbox{properties: {multiselect: false, numberOfColumns: 2, columnWidths: [60,60], columnTitles: ['A', 'B'], showHeaders: false}}");
          for (var k=1; k<8; k++){
              lb.add("item", (5*k).toString()).subItems[0].text = (11*(k+1)).toString();
              };
          
          w.show();
          

           

          You can play around with the creation properties.

          For me, if showHeaders is true, the columnTitles are displayed and the columnWidths are respected.

          But if it is false, the columnTitles are not displayed (as one would expect) but the columnWidths are not respected...

           

          Xavier

          • 2. Re: How do I script a dialog box to display information?
            Schmaltzkopf Level 1

            How can I make the text "selectable"?

            • 3. Re: How do I script a dialog box to display information?
              Peter Kahrel Adobe Community Professional & MVP

              Multi-column lists are certainly good for mimicking tables. Another possibility is to place edittextboxes very close to each other:

               

              w = new Window ('dialog {orientation: "row", spacing: 0}');
              
                column1 = [];
                group1 = w.add ('group {orientation: "column", spacing: 0}');
                for (i = 0; i < 7; i++) {
                  column1.push (group1.add ('edittext {preferredSize: [60,40], justify: "center"}'));
                }
                
                column2 = [];
                group2 = w.add ('group {orientation: "column", spacing: 0}');
                for (i = 0; i < 7; i++) {
                  column2.push (group2.add ('edittext {preferredSize: [60,40], justify: "center"}'));
                }
                
                for (i = 0; i < 7; i++) {
                  column1[i].text = String ((i+1)*5);
                }
              
                for (i = 0; i < 7; i++) {
                  column2[i].text = (i+2)*11
                }
              
                column1[0].active = true;
                
              w.show();
              

               

              Peter

              • 4. Re: How do I script a dialog box to display information?
                UQg Level 4

                In a listbox, only whole rows can be selected, not individual slots (items/subItems), and the content of slots cannot be edited directly.

                So Peter's solution seems more appropriate if you want to give the user the possibility to select individual slots and eventually edit them.

                 

                Xavier.

                 

                And i forgot to say in the first post that creation properties in listboxes are all optionnal (for instance you dont need to specify the columnWidths, in which case ScriptUI determines them to fit best).