The script below is part of a large script that’s nearly complete. But it has one nagging issue. It displays a table with two columns and the first column is basically labels and doesn’t need much space. The second column is data, and needs more space.
I’ve tried numerous combinations of
modify columns column width
and
modify table column widths pattern
But I can’t get the first column to be narrow and the second column to be wide.
Any suggestions?
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "AppKit"
use script "Myriad Tables Lib"
use script "Dialog Toolkit Plus"
set initialPosition to {30, 30}
set titleLists to {¬
{"dataTitle", "Category", "Channel", true, ¬
"PreferredTitle", ¬
"TitleOption1", ¬
"TitleOption2", ¬
"TitleOption3", ¬
"TitleOption4", ¬
"TitleOption5"}, ¬
{"Two and a Half Men", "Series -- Syndicated", "", false, ¬
"2 & 1/2 Men"}, ¬
{"Last Man Standing", "Series -- First Run and Syndicated", "Fox", false, ¬
"Last Man Standing", ¬
"Last Standing"}, ¬
{"The Daily Show With Trevor Noah", "Series -- First Run", "Comedy Central", false, ¬
"The Daily Show With Trevor Noah", ¬
"The Daily Show: Trevor Noah", ¬
"Daily Show: Trevor Noah", ¬
"The Daily Show", ¬
"Trevor Noah", ¬
"Daily Show"}, ¬
{"Saturday Night Live", "Series -- First Run and Syndicated", "NBC", false, ¬
"Saturday Night Live", ¬
"SNL"} ¬
}
repeat
set titleInfo to some item of titleLists
set {thisTitle, category, channel, episodeTitles} to titleInfo
set titleOptionlist to items 5 through -1 of titleInfo
set item 1 of titleOptionlist to {"Preferred", item 1 of titleOptionlist}
repeat with x from 2 to count of titleOptionlist
set thisTitleOption to item x of titleOptionlist
set thisTitleOption to {"Alt-" & ((x - 1) as text), (thisTitleOption as text)}
set item x of titleOptionlist to thisTitleOption
end repeat
set rowTemplate to {"", ""}
set selectedRows to {}
set tableTitle to thisTitle & " title options"
set theCategory to category
set theChannel to channel
--set viewParams to BuildAcceccoryView(episodeTitles, theCategory, theChannel)
--
--my CreateAccessory(viewParams)
--
-- create accessory view, passing controls plus size (as {width, height})
set tablePrompt to "Edit info and options for " & thisTitle
set theTable to make new table with data titleOptionlist ¬
with title tableTitle ¬
with prompt tablePrompt ¬
multiple selections allowed false ¬
empty selection allowed true ¬
row template rowTemplate ¬
can add and delete true ¬
editable columns {2} ¬
column headings {"", "Title Options"} ¬
row numbering false ¬
initially selected rows selectedRows
set OKButton to "Save" --1
set CancelButton to "Cancel (without saving)" --ERROR
set extraButton to "Edit" --2
modify table theTable ¬
OK button name OKButton ¬
cancel button name CancelButton ¬
extra button name extraButton ¬
highlighted rows {} ¬
grid style grid between columns ¬
column widths pattern {1, 2} ¬
alternate backgrounds true ¬
initial position initialPosition ¬
row dragging false ¬
without column reordering
-- modify table theTable accessory view theAccessoryView
modify columns in table theTable ¬
columns list {1} ¬
column width 5
modify columns in table theTable ¬
columns list {2} ¬
column width 35
try
set tableResult to display table theTable ¬
with extended results
on error errMsg number errNum
exit repeat
end try
end repeat