If I set its width to 10, and the buttons are wide, it adds space to the columns (including the first one, where the width is set). If the buttons are narrow, it displays correctly.
This version displays two tables. The only difference the width of the buttons. (and the title and prompt, but those have no effect)
Ideally, if space is added to columns to fit a wider window, it should be added to those whose widths are not set.
If widths are set in all columns, then no space should be added and the window should simply have a margin from the right side of the table to the right side of the window.
use scripting additions
use script "Myriad Tables Lib"
set playerRoster to {¬
{"1", "Clint", "Eastwood"}, ¬
{"2", "Mel", "Brooks"}, ¬
{"3", "Woody", "Allen"}, ¬
{"4", "Woody", "Harrelson"}, ¬
{"5", "Mel", "Gibson"}, ¬
{"6", "Mary", "Tyler Moore"}, ¬
{"7", "Katharine", "Hepburn"}, ¬
{"8", "Lauren", "Bacall"}, ¬
{"9", "James", "Stewart"}, ¬
{"10", "Clark", "Gable"}, ¬
{"11", "Carey", "Grant"}, ¬
{"12", "Colin", "Firth"}, ¬
{"13", "Henry", "Fonda"}, ¬
{"14", "Humphrey", "Bogart"} ¬
}
set tableData to playerRoster
set firstColumnWidth to 10
set OKButtonName to "Accept"
set OKButtonIsDefault to true
set cancelButtonName to "Cancel (Without Saving)"
set tableTitle to "With Wide Buttons"
set tablePrompt to "Column width for first column is set to 10 and no space is added. Space is added to all three columns"
set newTable to make new table with data tableData ¬
with title tableTitle ¬
with prompt tablePrompt ¬
with empty selection allowed
--modify column
set columnsToModify to {1}
set columnWidth to firstColumnWidth
--Will not allow a narrow first column if the window is wide
modify columns in table newTable ¬
columns list columnsToModify ¬
column width columnWidth ¬
--Modify table
modify table newTable cancel button name cancelButtonName
--If you note out the modify table line above you'll see how it works when the window in not unusually wide.
set tableResult to display table newTable ¬
with extended results
set OKButtonName to "OK"
set cancelButtonName to "Cancel"
set tableTitle to "With Narrow Buttons"
set tablePrompt to "Column width for first column is set to 10. No space is added to the columns."
set newTable to make new table with data tableData ¬
with title tableTitle ¬
with prompt tablePrompt ¬
with empty selection allowed
--modify column
set columnsToModify to {1}
set columnWidth to firstColumnWidth
--Will not allow a narrow first column if the window is wide
modify columns in table newTable ¬
columns list columnsToModify ¬
column width columnWidth ¬
--Modify table
modify table newTable cancel button name cancelButtonName
--If you note out the modify table line above you'll see how it works when the window in not unusually wide.
set secondTableResult to display table newTable ¬
with extended results