hi… i’ve tried a number of ways to set apart table columns in a table view but have come up empty handed. Ideally I would like to set the background color for particular columns, or the text color, or borders on the sides of the columns, or anything. The only thing that worked was to set the highlighted of the header cell to true.
I don’t want to use C to do this. Of course if this could be done in Interface Builder it would be even better, because it doesn’t need to be dynamic. But I haven’t seen that to be possible either.
tell tab view item "podcasts" of tab view "maintabs" of window "main"
tell scroll view "podcastsscroll"
tell table view "podcaststable"
set smcol to table column "sm"
--set control tint of header cell of smcol to blue tint
--set background color of header cell of smcol to {65535, 65535, 65535}
--set highlighted of data cell 5 of smcol to true
set highlighted of header cell of smcol to true
--set bordered of header cell of smcol to true
(*
repeat with c from 1 to (count data cells of smcol)
set theCell to item c of (data cells of smcol)
set background color of theCell to {65535, 65535, 65535}
end repeat
*)
end tell
end tell
end tell
On a side note, what’s the easiest way to use a color picker to get the decimal values AS Studio needs for colors?
Edit: I couldn’t find the kind of color picker I wanted so I wrote one. Probably reinventing the wheel, but FWIW, here it is:
http://bbs.applescript.net/viewtopic.php?pid=76889
Thanks…
This is completely weird. Here’s what I’ve found so far. Best solution for me at the moment is to use colored backgrounds for table column header cells and colored text for the data cells. Looks weird but best that can be done at the moment given the oddity of ASS.
-- for any coloring, the option for alternating row coloring has to be OFF for the table view in IB
tell table view "podcaststable" of scroll view "podcastsscroll" of tab view item "podcasts" of tab view "maintabs" of window "main"
set smcol to table column "sm"
-- header cell can be highlighted
set highlighted of header cell of smcol to true
-- header cell can be bezeled
set bezeled of header cell of smcol to true
set bezeled of header cell of smcol to false
-- header cell background color can be changed but ONLY IF bezeled is toggled on and off first (weird!!! even really weird)
set background color of header cell of smcol to {32896, 0, 16448}
-- header cell text color CANNOT be changed
set text color of header cell of smcol to {65535, 65535, 0}
--text color of data cell can be changed
set text color of data cell of smcol to {65535, 65535, 0}
-- background color of data cell CANNOT be changed
set background color of data cell of smcol to {32896, 0, 16448}
-- data cells can be bordered
set bordered of data cell of smcol to true
-- control tint unknown
--set control tint of data cell of smcol to graphite tint
update
end tell
EDIT:
Even yet still more weirdness: on some builds of the application, when run the bezel cannot be set and therefore the header cell bg color can’t be set (can’t get object errors). If I go back to XCode and select “use alternating rows” for table view, save, and then unselect that and save again, and then build, that fixes it. Grrr.
Edit 2:
And still more weirdness. This doesn’t persist from build to build. Sometimes toggling the “alternating rows” doesn’t work to get back the ability to set bezel/background, and get this… sometimes setting alternating rows ON appears to bring back that ability.
I’d really appreciate if someone can explain what’s going on here…