NSTreeController and insertObject:atIndex question.

  • I have a NSTreeController. Its content is bound to my document class
    to get the NSArray behind the top level of the tree. When my
    windowController gets a command to import a movie I do the following..

    -(IBAction)importMovie:(id)sender
    {
    NSMutableArray* array = [self
    mutableArrayValueForKeyPath:@"document.project"];

    if (array != nil)
    {
      NSOpenPanel* openPanel = [NSOpenPanel openPanel];

      if ([openPanel runModalForTypes:[QTMovie movieFileTypes:0]] ==
    NSOKButton)
      {
      QTMovie* movie = [QTMovie movieWithFile:[openPanel filename]
    error:NULL];
      VAMovieNode* movieNode = [VAMovieNode withMovie:movie];

      [array insertObject:movieNode atIndex:0];
      }
    }

    }

    Then my document has the following call to do some document specific
    stuff, right now its stubbed... The idea behind this is that the movie
    can create the basic items but there are some very specific things,
    like undo, that the document can handle.

    - (void)insertObject:(VATreeNode *)transaction
        inProjectAtIndex:(unsigned int)index
    {
        // implementation specific code
        return;
    }

    I have also tried..

    -(void)insertProject:(NSArray *)objects atIndexes:(NSIndexSet*)index

    However when i place break points into these calls they are never
    hit.. Are the insert calls different for NSTreeController?

    Scott Andrew
previous month october 2007 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