Programmatically adding objects to a bound outlineview

  • Hi,

    I have succesfully managed to list items in my outlineview, which is
    bound to an NSTreeController. However, while testing my application I
    had made a root object and added some children on the initmethod of
    the content provider object of the NSTreeController.

    But when I add an object while selecting a menu in my nib, it doesn't
    work. My add method is called, but the outlineview doesn't get
    refreshed, even though I do reload the data.

    I'm guessing I need to do something with NSIndexPath since that's
    what NSTreeController uses to find out where to put objects.

    I've been looking around but haven't found a clear example on how to
    use index paths. Currently my method to add an item looks like this.

    docElement is the object I use as my root node.
    - (IBAction)addMediaElement:(id)sender {
    [docElement addChildItem:[FusionMediaElement
    mediaElementWithName:@"Video" ofType:FusionMediaElementVideoType]];
    [elementsOutlineView reloadData];

    Thanks in advance,

    Jesus De Meyer
    "creativity in mind"
previous month october 2006 next month
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