Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MacRumoron

macrumors 6502
Original poster
Sep 6, 2005
324
0
How would I get this cursor without having to save an image of it and putting it inside my app bundle?

cursorew2.jpg


Thanks in advance
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
It's not directly available in Cocoa. You can get it to appear in Cocoa apps if you accept a drag with certain masks but that's because the Finder is setting it.

As you can see here it can be set via a Carbon call but not a Cocoa one. Just call the Carbon method.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
It's not directly available in Cocoa. You can get it to appear in Cocoa apps if you accept a drag with certain masks but that's because the Finder is setting it.

As you can see here it can be set via a Carbon call but not a Cocoa one. Just call the Carbon method.

No need to go with Carbon. Just setup your NSView like this:

Code:
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
	return NSDragOperationCopy;
}
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
No need to go with Carbon. Just setup your NSView like this:

Code:
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
	return NSDragOperationCopy;
}

That was what I was alluding to when I said "if you accept a drag with certain masks". I assumed the OP was wanting to make this appear in other conditions via a NSCursor set call, which cannot be done, but can via Carbon.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
That was what I was alluding to when I said "if you accept a drag with certain masks". I assumed the OP was wanting to make this appear in other conditions via a NSCursor set call, which cannot be done, but can via Carbon.

Ah I see. But it seems like if you were using this cursor outside of a drag, it would be inconsistent UI.

I would be willing to bet that that cursor is available via a private method call as well *tinkers with class-dump*

Edit: this does the job, although it could break in Leopard:
Code:
[[NSCursor _copyDragCursor] set];
 

MacRumoron

macrumors 6502
Original poster
Sep 6, 2005
324
0
No need to go with Carbon. Just setup your NSView like this:

Code:
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
	return NSDragOperationCopy;
}

this is what i was looking for, thanks everyone :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.