modalForWindow query

  • I've been working with the XML parser example from Apple (see below for
    link), and have included it in a Cocoa application of mine.

    The problem is nothing to do with the XML side of things, but rather
    NSOpenPanel. In particular, this line of code:

        [oPanel beginSheetForDirectory:startingDir file:nil types:fileTypes

                        modalForWindow:[self window] modalDelegate:self //
    Warning for this part

                        didEndSelector:@selector
    (openPanelDidEnd:returnCode:contextInfo:)

                          contextInfo:nil];

    The warning I receive is: 'MyController' may not respond to '-window'

    In Interface Builder I have an instance subclass of NSObject called
    MyController with an NSButton and NSTextView on it. I'm guessing that the
    [self window] is looking for an NSWindow, but where should that be defined?

    XML Parser Basics link:
    http://developer.apple.com/documentation/Cocoa/Conceptual/XMLParsing/Articl
    es/UsingParser.html
  • If you want a reference to the main window, check out the
    documentation for NSApplication.

    On Oct 25, 2006, at 12:36 AM, Nicholas Brawn wrote:

    > ...
    > The warning I receive is: 'MyController' may not respond to '-window'
    > ...
    > In Interface Builder I have an instance subclass of NSObject called
    > MyController with an NSButton and NSTextView on it. I'm guessing
    > that the
    > [self window] is looking for an NSWindow, but where should that be
    > defined?
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today