Countdown of typed letters - deleting text field

Hi Folks,

is it possible to count the letters (countdown from 160 to 0) in a NStextfield and erease this textfield by clicking a button?
Background: I want to send sms messages which are not longer than 160 letters!

Thanks for your answers…


Hi Folks,

deleting is quite easy:

	if name of theObject is "sms_delete" then
		set contents of text view "text" of scroll view "text" of tab view item "Outbox" of tab view "tab" of window "main" to ""
	end if

Best regards,


Hi Stefan,

maybe you want sth like this?

on changed theObject
	set remainingChars to 160 - (length of (get theObject's content))
	set content of text field "counter" of window "main" to remainingChars
	if remainingChars < 0 then
		set theObject's content to (text 1 through 160 of (get theObject's content))
		set content of text field "counter" of window "main" to "0"
	end if
end changed