Hi, everyone.
Currently I am working on a project which uses the NSOutlineview heavily. I
thought the drag and drop functions are very important, so I am trying to
implement that.
However, after refer to some tutorials, I still can't make it work... My
steps are :
1. create a controller to manage the outlineview, set the controller to the
datasouce and delegate for the outlineview.
2. register the outineview with the following code in the awakeFromNib
method:
[_outlineView registerForDraggedTypes:
        [NSArray arrayWithObject:MyPrivateTableViewDataType]];
3. implement the following methods:
- (BOOL)outlineView:(NSOutlineView *)ov
         writeItems:(NSArray *)items
       toPasteboard:(NSPasteboard *)pboard
 {

     draggedNodes = items;
    NSlog(@"In the outlinew writeItems method!");
     [pboard declareTypes:[NSArray
arrayWithObject:MyPrivateTableViewDataType] owner:self];
     [pboard setData:[NSData data] forType:MyPrivateTableViewDataType];

    return YES;
}

- (NSDragOperation)outlineView:(NSOutlineView*)ov
                  validateDrop:(id <NSDraggingInfo>)info
                  proposedItem:(id)item
            proposedChildIndex:(NSInteger)childIndex{

      NSLog(@"Return the NSDragOperation");
    draggedNodes = [[[info draggingSource] dataSource] draggedNodes];
        return NSDragOperationGeneric;
}

- (BOOL)outlineView:(NSOutlineView *)ov
         acceptDrop:(id <NSDraggingInfo>)info
               item:(id)item
         childIndex:(NSInteger)childIndex
{
   NSLog(@"should we return the accetpDrop?");
   return YES;
}

After compiled the application and set it up, I had no chance to
successfully get anything from the console although there are so many output
statements when I drag and drop items repeatly.
Can anyone here give me some help or guidance about this issue?
Thank you very much for any help. Good luck.

-- 
Best regards.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to