judging from the error you are getting you either connected the
"awake from nib" handler to the wrong object or you have multiple
objects connected to the "awake from nib" handler. Anyway here is
what happens:
A window awakes from nib and calls the handler. The theObject
variable thus holds the window object and then you try to tell the
window of theObject to set contents of various text fields. A window
does not have a window as element. If you look again at the error
message:
"Can't make contents of text field "x" of window of window id 1 into
type reference. (-1700)"
You'll see that it says that it was trying to get text field "x" of
WINDOW of WINDOW id 1.
What you need to do is check what objects have the "awake from nib"
handler connected in Interface Builder. If you really need to have
mulitple objects call the "awake from nib" handler then your handler
will have to look something like this:
on awake from nib theObject
try
set objName to name of theObject
get objName
on error errorMessage
error "awake from nib: Getting name of some object: " & errorMessage
end try
if objName is "mainWindow" then
-- Run code for main window
else if objName is "clientName_TextField" then
-- Run code for text field 1
else if objName is "clientAge_TextField" then
-- Run code for text field 2
end if
end awake from nib
Adrian
On Jan 2, 2006, at 8:49 PM, andrew remuzzi wrote:
I have a simple calculation application i am trying to get working
but i cannot seem to "set text fields" to a default value.
I am using Xcode 2.0 with 10.4.3
here is the relevant code
on awake from nib theObject
tell window of theObject
set the contents of text field "X" to "0"
set the contents of text field "y" to "0"
updateDisplay(theObject)
end tell
end awake from nib
the error i get is
"Can't make contents of text field "x" of window of window id 1
into type reference. (-1700)"
if i drop the tell window line i get
"Can't make contents of text field "x" into type reference. (-1700)"
later in the script in response to a button click this line works fine
on clicked theObject
tell window of theObject
try
set the contents of text field "x" to theXvar
on error
set the contents of text field "x" to "error"
end try
end tell
end clicked
anyone have amy insight on what i am doing wrong ?
thanks
stimpy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list (Applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-studio/lists%
40macevangelist.de