disable NSDatePicker row 2 of radio button is clicked?

Firstly, I’m a newbee so please excuse my ignorance!

I’m trying to set up a tab view so that if the second radio button is clicked then the NSDatePicker will become disabled. I have been trying to use:

on clicked theObject
	if name of theObject is "i'll set the date" then
		set enabled of control "date picker" of window "main" to 0
	end if

However, I keep getting this error:

It seems to carry out the operation if I use a checkbox instead of the NSDatePicker:

on clicked theObject
	if name of theObject is "manual" then
		set enabled of button "check1" of window "main" to 0
	end if

I presume I am either addressing the class incorectly, or am I just missing something !?

Also, the datepicker “date picker” is inside a border inside tab view 2 inside window “main” so do i need to make a full reference of that. (I dont with the checkbox.)

OK, I can disable the datepicker via the button if the datepicker is inside window “main” so i guess the problem is the adres of the datepicker,

I’ve tried:

on clicked theObject
	if name of theObject is "i'll set the date" then
		set enabled of control "datepicker" of tab view item "problem" of tab view "info pannels" of box "border" of window "main" to false
	end if

But i just get a NSReceiverEvaluationScriptError: 4 (1) message when the button is clicked!!

The full script is available if you want to see it (although its probably a bit messy)

Many thanx in advance,

Model: powerbook
AppleScript: Version 2.1 (80)
Browser: Safari 412.5
Operating System: Mac OS X (10.4)

Is this button in the same tab view as the date picker? If it is, then try this:

on clicked theObject
	if theObject's name is "i'll set the date" then
		tell control "datepicker" of theObject's super view
			get ((enabled as integer) + 1) mod 2
			set enabled to (result)
		end tell
	end if
end clicked

Also, can you explain (or show) what you’re using radio buttons for? If there will only be two choices, I could make another suggestion.

hi bruce,
and thanks for your reply,
yes the button is in the same tab view as the date picker.
i managed to solve the error (i,d accidently spelt panels with two n’s (doh!!!))

about the radio buttons,
i am trying to build a little interface that will enter a new open file event in icall at either the current date or a specific date.

i am using the radio buttons to allow the user to choose between selecting the current date or defining a specific date using date picker.

so far so good, data is bieng validated and added to the summery on entering the next tab and summerized on the final tab.
my next problem is getting the summery to understand that i have changed the date to be summerized as it still summerizes the date picker even if it is disabled.

is there a way that i can set a flag or value when the "use current date " button is clicked so when it comes to summerizing the date, the correct date will be stored.