I need to launch a modal window from a plugin in a video application. I created a Nib in Interface builder along with an NSWindowController class. But when I try to run the window like this
Registration* newWin = [[Registration alloc] initWithWindowNibName:@"Options"];
[NSApp runModalForWindow: [newWin window]];
It gives me an error in the Console : Modal Session requires Modal Window I think it has something to do with Interface Builder (Pardon me, I am really new to IB).
Here is the link to the Nib file and the Classes. I would appreciate it if someone could tell me what I did wrong in IB. Thanks.
[Link Removed]
You instantiated an instance of Registration
in the nib file. That's not the way you prepare a nib file for use with an NSWindowController
. That Registration
object is a distinct object contained in the nib file, not the Registration
object you allocated in the code you quoted above.
In the nib passed to initWithWindowNibName
, the File's Owner
is the NSWindowController
instance you create in the code. So, in the inspector, set the class name of the File's Owner
to be Registration
and connect its window
outlet to be your window object inside the nib file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With