Number Formatter in a table view

Whenever I try and get a number formatter to work in a table view nothing shows up in the column. The number formatter formats the entry as currency. What am I doing wrong? :confused:

property theDataSource : null


(* ==== Event Handlers ==== *)
on launched theObject
	-- Set up theDataSource so that the rest will be simpler
	set theDataSource to make new data source at end of data sources with properties {name:"Owed Money"}
	set data source of table view "tableView" of scroll view "scrollView" of window "main" to theDataSource
	
	-- Here we will add the data columns to the data source of the table view
	tell theDataSource
		make new data column at the end of the data columns with properties {name:"name"}
		make new data column at the end of the data columns with properties {name:"amount"}
	end tell
	tell window "main"
		set fmter to formatter of data cell of table column 2 of table view "tableView" of scroll view "scrollView"
		-- get:
		set fmt to call method "format" of fmter
		-- set
		call method "setFormat:" of fmter with parameter "0.0"
	end tell
	
end launched
on clicked theObject
	if name of theObject is equal to "addEntry" then
		-- Add a new contact
		set theRow to make new data row at the end of the data rows of theDataSource
		tell window "main"
			set contents of data cell "name" of theRow to "Hello"
			
			set contents of data cell "amount" of theRow to "5.5"
		end tell

Hallo hendo13,

because there is no answere up to now from the forum about your problem, I try to tell you about my experience with formattering a table view.
It seems to me, that your code is correct. I did it in the same way and it works.
Maybe you have inserted additionly a formatter in IB to the column. Select the column until you get the ‘Text Field Cell Attributes’ in IB. If there is a yellow mark, select it; you get the formatter panel.
I think you should delete it and try to compiling the app again. Maybe it will help you.

Heiner

thank you for your reply. I’m not sure I fully understand you. You think I should delete my formatter, recompile, then add it in again?

Delete the formatter and recompile; thats all.
You will format the column by the script and not by IB.

Hallo hendo13,

sorry, I wrote rubbish. Of course I set the formatter to my columns; but it’s a long time ago since I wrote the code.

I call the handler for formatting from a popup button by the ‘on action’ handler. Mybe you have success, if you set the formatting code into your ‘on clicked’ handler.

Heiner