Concerning Custom Sheets and NIB files...
Concerning Custom Sheets and NIB files...
- Subject: Concerning Custom Sheets and NIB files...
- From: Christopher Frederick <email@hidden>
- Date: Sat, 9 Jul 2005 19:57:24 -0700
Hello everyone,
I hope this question doesn't come out sounding quite as trivial as I
am afraid it will; however, as I am still getting my feet wet with
Cocoa, so to speak, I suppose that such triviality is inevitable
until I finally get my bearings in this brave new world...
To ensure that we are all "on the same page", allow me to give the
following disclaimer: my discussion ties in directly with the ADC
Home > Reference Library > Documentation > Cocoa > User Experience >
Windows and Panels > Sheets documentation in general, and the "Using
Custom Sheets" article in particular.
That said, let us move on to the details. "Using Custom Sheets"
illustrates a scenario in which an application contains two NIB
files, one for the starting window of the application (or at least
the window to which the sheet will be attached) and one for the
custom sheet, named MyCustomSheet. The former of the two NIB files
defines the method showCustomSheet, as it will presumably be calling
the method to attach the sheet to one of its windows. The
MyCustomSheet NIB file defines the closeCustomSheet (which does not
match its later definition in the documentation, closeMyCustomSheet,
BTW) method and didEndSheet selector, as the sheet needs to be able
to call these methods through Target/Action connections with a "Done"
button of some kind. Okay, that makes sense.
The part where my code, based upon this documentation, crashes is
within showCustomSheet. Please examine the following code segment:
if (!myCustomSheet)
[NSBundle loadNibNamed: @"MyCustomSheet" owner: self];
[NSApp beginSheet: myCustomSheet
modalForWindow: window
modalDelegate: self
didEndSelector: @selector
(didEndSheet:returnCode:contextInfo:)
contextInfo: nil];
Even if myCustomSheet is Nil, which it should be initially, the call
to NSBundle's loadNibNamed:owner: does nothing to remedy the
situation. Stepping through this code in the debugger reveals that
myCustomSheet is still Nil, which causes the call to beginSheet to
throw. Furthermore, it is not clear to me what, precisely,
myCustomSheet represents: is it a global variable? Is it an IBOutlet
associated with myAppDelegate? Is it a class member of one of the
windows? The sample code does not seem to address these concerns.
Thanks in advance to the first person to point out the obvious for me
in this situation. ;)
---Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden