Login

AppleScript Studio - Resizing Table Columns Programmatically

Here is a simple way to resize table columns in AppleScript Studio programmatically.
I have created a sample project which you can download icon AdjustTableViewColumnWidth (67.55 kB).

 

 

pic1.jpg

The AppleScript to Change Width and Column Title


-- AdjustTableViewColumnWidth.applescript
-- AdjustTableViewColumnWidth


--  Created by Craig Williams on 8/24/09.

on clicked theObject
 
tell window "main"
 set col_one_width to contents of text field "col_one_width"
 set col_two_width to contents of text field "col_two_width"
 set col_one_name to contents of text field "col_one_name"
 set col_two_name to contents of text field "col_two_name"
 
 set tableView to table view 1 of scroll view 1
 set width of table column 1 of tableView to col_one_width
 set width of table column 2 of tableView to col_two_width
 set title of header cell of table column 1 of control 1 of scroll view 1 to col_one_name
 set title of header cell of table column 2 of control 1 of scroll view 1 to col_two_name
 end tell
end clicked

on awake from nib theObject
 tell window "main"
 set contents of text field "col_one_width" to 100
 set contents of text field "col_two_width" to 100
 set contents of text field "col_one_name" to "First Name"
 set contents of text field "col_two_name" to "Last Name"
end tell
end awake from nib

Add comment


Security code
Refresh

 

Product Categories