Number Formatter in a table view

I want to change the number formatter in a table view’s columns dynamically by the script, once as an integer-format, once as a decimal-format.
I tried this, but without success.

set countOfRows to (count of data rows of dataSource)
		tell dataSource
			repeat with i from 1 to countOfRows
				set theDataCell to contents of data cell "a" of data row i
				--log theDataCell
				set newFormat to (call method "setFormat:" of object theDataCell of class "NSNumberFormatter" with parameter "0.0")
				--log newFormat
			end repeat
		end tell

Can anyone help me?

Heiner

Model: eMac
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hi Heiner,

you can address the formatter like this:

	set fmter to formatter of data cell of table column 1 of table view "tv" of scroll view "sv" of window 1
	-- get:
	set fmt to call method "format" of fmter
	
	-- set
	call method "setFormat:" of fmter with parameter "0.0"

D.

Hi Dominik,

thank you for your help, now my app works properly.

Heiner

And for those, who are interested in that problem: It works under two additional conditions:

  1. In IB the attribute ‘Number Formatter’ has to be added by drag and drop accordingly to the columns .
  2. In the table view the numbers have to be inserted after formatting the columns.

Model: eMac
Browser: Safari 419.3
Operating System: Mac OS X (10.4)