The alignment is a property of the data cell of the table column, not of the column itself. It seems that support for the data cell object has been dropped in ASS, so you’ll have to use a custom subclass in obj-c to get it done.
First create a new obj-c file, and name it “JBTableColumn.m” (don’t worry about the .h file). Paste this into the file…
Then, anywhere in your code use something like this to toggle the alignment…
set theAlignment to "Right"
set theTableColumn to table column "Column1" of table view "table" of scroll view "scroll" of window "window"
call method "changeTableColumnAlignment:toAlignment:" of class "JBTableColumn" with parameters {theTableColumn, theAlignment}
tell table view "table" of scroll view "scroll" of window "window" to update
The obj-c code will accept the parameters “Right” and “Centered” (case sensitive), and any other call will set it to the default left alignment.
Thanks jobu - that does almost what I was hoping, but not quite.
The reason I wanted it was because I have a table which contains file names, including paths, so if the table is resized quite small, I wanted to be able to display the right hand end of each name.
Your code does the job, ie, it sets the alignment to the right, however the columnd doesn’t truncate the left hand side of the data like I hoped it would. In other words, if the table is large, the contents of the cell go to which ever side I want using your code. If it is small, the column doesn’t really change.
Any ideas of a way around this? I suppose I could do something in the code, but that would be quite slow…
This partially came about because for some reason, the horizontal scroll bar doesn’t appear on the table even though it is configured in interface builder. Sometimes it appears, but as soon as the window is resized, it goes again. Is this a known bug?