Passing numbers through userdata
Passing numbers through userdata
- Subject: Passing numbers through userdata
- From: Christopher Drum <email@hidden>
- Date: Tue, 14 Dec 2004 20:56:58 -0800
Hi all,
I'm running into a small issue with passing an NSNumber through the
userdata property of a tracking rect. When adding the tracking rects, I
put an int into an NSNumber and put that into the userdata. Then, I
grab [[theEvent userData] intValue] in -(void)mouseEntered:(NSEvent
*)theEvent. The compiler flags a warning of "invalid receiver type
'void *' on that particular line of code. However, it works. So, even
though it's flagging the code, it's clearly not a big problem... or is
it?
If I pass an int directly through the userdata property, I get the
problem "warning: passing arg 3 of
`addTrackingRect:owner:userData:assumeInside:' makes pointer from
integer without a cast" However, it does work, even though when I
retrieve the int I get the warning, "assignment makes integer from
pointer without a cast"
So, just how does one pass an integer through the userdata of a
tracking rect, or for any object with a userdata property, without
these kinds of flags?
------------------------------------------------------------------
Christopher Drum
http://homepage.mac.com/christopherdrum
Check out FileWrangler, my five-star rated (MacUpdate, VersionTracker)
Cocoa app written in Objective-C for the batch renaming of files.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden