Hi Kevin,
I've seen that kind of exception when I was working on the sytemtray extension, I'm not sure I'm right, not even sure if I remember correctly, but I think you're confusing "sender" and "selector", sender is the argument, and 'selector' is the object itself, I think.. so the "unrecognized selector" error means that the object you are calling is wrong. In your case :
[dropview draggingEntered:nil ]; 
it means that the 'dropview' pointer is invalid or is not a TKContentView.
Other possibility is that the 'selector' is not the object, but the method, so the object could be valid, but does not have a 'draggingEntered' method defined.
You showed the code for draggingEntered, but how do you define it? what class is implementing that? I don't suppose it comes from the Tk internal code, and I suppose that TkMacOSXGetRootControl is an internal Tk API, so I'm guessing Tk returns to you an object that is not an instance of the class you've implemented which has that draggingEntered method..
Assuming you do something like (pseudocode):
class MyClass:
  method draggingEntered:
    print entered
You should probably be doing :
dropview = MyClass(TkMacOSXGetRootControl())
[dropview draggingEntered]
and have your 'Myclass' encapsulate the TkContentView class.
Hope I'm not saying something stupid and I hope it helps,
KaKaRoTo

On Fri, Nov 13, 2009 at 10:33 AM, Kevin Walzer <kw@codebykevin.com> wrote:
Thanks to all for helping me with the basic issue of Tk_InitStubs for my
port of TkDND to OS X. I've gotten my extension to build and load
without blowing up Wish, but it still doesn't do anything: here is where
my real work begins.

There appears to be a disconnect between how NSDragging works in the
Cocoa frameworks and how this can be accessed from a Tk window, and I
need to figure out how to bridge that gap.

Here's a basic example. The Cocoa method for noting when the drag has
entered the target widget is below:

- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {

  dragPasteboard = [sender draggingPasteboard];

  NSLog(@"entered");
  if ( [dragPasteboard types] != nil) {
    return NSDragOperationEvery;
  } else {
    return NSDragOperationNone;
  }
}

And here's how I'm calling this from Tk:

//Tk window methods
int HandleDragEnter(ClientData clientData, Tcl_Interp *ip,
                     int objc, Tcl_Obj *CONST objv[]) {
  if (objc != 2) {
    Tcl_WrongNumArgs(ip, 1, objv, "path");
    return TCL_ERROR;
  }


  Tk_Window path;
  path = Tk_NameToWindow(ip, Tcl_GetString(objv[1]), Tk_MainWindow(ip));
  if (path == NULL) {
    return TCL_ERROR;
  }

  Drawable d = Tk_WindowId(path);

  dropview = TkMacOSXGetRootControl(d);
  [dropview draggingEntered:nil ];
  [dropview prepareForDragOperation:nil ];
  [dropview performDragOperation:nil  ];

  return TCL_OK;

}

I never see the  "entered" message printed to stdout, which tells me
that the method isn't being called. I think I know why. The [dropview
draggingEntered:nil] call is supposed to fire the "entered" message. The
problem is that this method calls for a "sender" argument (id sender),
but I have no clue how that can be accessed from Tk. I have to put
something in that parameter, otherwise I get an error, like so:

11/12/09 11:48:33 PM Wish[11266] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '*** -[TKContentView
draggingEntered]: unrecognized selector sent to instance 0x800053aa0'

I suspect that setting the parameter to "nil" is causing the method to
do nothing because there's no "sender."  What can I pass to the method
as a "sender" parameter, other than "nil"?

--Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tcl-mac mailing list
tcl-mac@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tcl-mac