I'm trying to create new window with given origin in Cocoa/AppleScript type application.
I have Main NIB with main window and another one called hud
. With button in main window I open new window (hud) in that way:
set winn to NSWindowController's alloc()'s initWithWindowNibName_("hud")
winn's showWindow_("jkb")
The window is showing up.
I want to show it in different location on the screen but without any luck. I have tried every combination of those two:
set myOrigin to {x:330,y:330}
or set myOrigin to {330,330}
with every line listed below:
current application's winn's class "NSWindow"'s class "NSView"'s setFrameOrigin_(mySize)
--class "NSView" of class "NSWindow" of winn doesn’t understand the “setFrameOrigin_” message
current application's winn's NSWindow's setFrameOrigin_(myOrigin)
--NSWindow of winn doesn’t understand the “setFrameOrigin_” message
current application's winn's class "NSView"'s setFrameOrigin_(myOrigin)
--class "NSView" of winn doesn’t understand the “setFrameOrigin_” message
current application's winn's jkb's class "NSView"'s setFrameOrigin_(myOrigin)
--class "NSView" of jkb of winn doesn’t understand the “setFrameOrigin_” message
current application's jkb's class "NSView"'s setFrameOrigin_(myOrigin)
--class "NSView" of jkb doesn’t understand the “setFrameOrigin_” message
current application's jkb's NSView's setFrameOrigin_(myOrigin)
--NSView of jkb doesn’t understand the “setFrameOrigin_” message
current application's jkb's class "NSView"'s setFrameOrigin_(myOrigin)
--class "NSView" of jkb doesn’t understand the “setFrameOrigin_” message
winn's jkb's class "NSView"'s setFrameOrigin_(myOrigin)
--this class is not key value coding-compliant for the key jkb.
when I check through log ... frame
I see objects so why do they not respond to setFrameOrgin_()
?
Finally I solved the problem. In hud
nib I bind the window to a property hudWindow: missing value
in a new, different script than main delegate. In this script I have created another method awakeFromNib()
. When it is called I finally can point to the right object (hudWindow
) and set its parameters. Thank you