Opening new windows (as sheets or dialogs)

I’m writing a quick application and as part of that would like to display some help info as a sheet. I’ve looked at the Apple documentation and also code snippets from this site and others but I can’t make it work.

I tried making a prototype app to keep things simple and it corrently contains the following code:

on clicked theObject
if the name of theObject is “button” then
load nib “Untitled”
set mywindow to window “window2”
display window mywindow attached to “window1”
end if
end clicked

At the moment I have one window in the MainMenu.nib and the other window in Untitled.nib. The windows are named window1 and window2 in the applescript pane of Inspector…

However when I run this I get the error:

Can’t make window (window id 3) into type reference. (-1700)

Can anyone point me in the right direction?



What you’re really saying there is.

display window window "window2" attached to "window1"

Try something like this:

display window "window2" attached to "window1"

Thanks for the reply but changing the code leads to a different error:

NSReceiversCantHandleCommandScriptError (4)

I’m sure this should be a simple task but it’s proving difficult for me :frowning:



This same EXACT error is plaguing me…

has anyone solved it? I have a nib: “EndiciaDetail” containing NSWindow “EndiciaDetailWindow” attached to my project.

Someone clicks a button on “MainWindow” and it should open this window

I have the following:

log "Loading NIB for EndiciaDetail"
	load nib "EndiciaDetail"
	log "Setting view"
	set theEndiciaTableView to table view "listingtable" of scroll view "listingview" of window "EndiciaDetailWindow"
	log "Setting content of theEndiciaTableView"
	set content of theEndiciaTableView to EndiciaDetailsList
	log "Displaying Window"
	display panel window "EndiciaDetailWindow" --dies here w/same error "NSReceiversCantHandleCommandScriptError (4)"

plz help!



It worked.

Why are some windows

display window


display panel window

and others

set visible of window


Just wondering. It is a pain to remember.

Again, thanks!