discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drag & Drop Problem


From: Andreas Höschler
Subject: Re: Drag & Drop Problem
Date: Thu, 1 Nov 2007 18:25:05 +0100

Hoi Fred,

I tried to reproduce this problem with NSImageView and after removing
the check for ([sender draggingSource] != self) in draggingEntered: it
is possible to drag onto the same view.

My SRCalendarView is a subclass of NSImageView. I have overwritten (for test purposes) the following methods:

- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
   NSLog(@"draggingEntered %@", sender);
return (NSDragOperationCopy | NSDragOperationLink | NSDragOperationMove);
}

- (void)draggingExited:(id <NSDraggingInfo>)sender;
{
   NSLog(@"draggingExited %@", sender);
}

- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
{
   NSLog(@"prepareForDragOperation...");
   return YES;
}

- (NSDragOperation)draggingSourceOperationMask
{
return (NSDragOperationCopy | NSDragOperationLink | NSDragOperationMove);
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
   NSPasteboard *thePasteboard = [sender draggingPasteboard];
   NSArray *types = [thePasteboard types];
BOOL result = ([types firstObjectCommonWithArray:[self pboardTypes]] != nil);
   NSLog(@"performDragOperation %d", result);
   return result;
}

/*- (NSDragOperation)draggingSourceOperationMask
{
   return _draggingSourceOperationMask;
}*/

- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
{
}

I get draggingExited and draggingEntered, but the drag sign is "Do Not Enter" the whole time and when I let it go the drag image slides back. No luck! I am stuck!

This means it isn't a general problem in GNUstep. Either it is related
to you specific class or NSDragOperationLink isn't correctly propagated
(which would surprise me with current GNUstep code).

I have no idea. I just know that the exact same code works great under MacOSX whatever that means.

I will need more information from your side to make any further progress.

What else can I provide?

Hey, I just dicovered something. I initiate the drag operation when the user presses the Ctrl-Key. That's by design (May be I should thing this over, but that how all drag and drop works an dall our applications so far). If I initiate the drag with the Ctrl-Key pressed and the let the Ctrl-Key go while still dragging, the "Do-Not-Enter" sign becomes a "Copy" sign and I can successfully drop.

Mac OS X behaves differently here. The drop works with a pressed Ctrl-Key. What exactly does a pressed Ctrl-Key mean to GNUstep?

Thanks,

  Andreas

Are you referring to the same view that started the drag? It is possible
that GNUstep excludes this view from getting drag notifications.
If you mean another view, is it in the same application, same window?

Is this the first time you use drag&drop and if nto, what is the
difference?

Yes, I am referring to the same view/window. It is a caalendar view and
the drag and drop is supposed to move appointments from one day to
another. This works on MacOSX. Does the spec say the originating view
should be excluded?

I also realized problems while dragging from this calendar view to
another view/window but haven't had time to dig into that any further.
The weird thing is, I can drag to these two views from even another
view/window (tableview) without problems. :-(

All is the same application and everything works fine on MacOSX. I will
investigat ethe second case further, but IMHO there should be a way to
avoid the exclusion (dragging within a view).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]