Copy link to clipboard
Copied
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.
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
...Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
How can I make the text "selectable"?
Copy link to clipboard
Copied
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.text = String ((i+1)*5);
}
for (i = 0; i < 7; i++) {
column2.text = (i+2)*11
}
column1[0].active = true;
w.show();
Peter
Copy link to clipboard
Copied
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).
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more