• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Passing numbers through userdata
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Passing numbers through userdata
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: Re: Kill other process's warning dialog
  • Next by Date: Substituting low level BSD stuff with spiffy Cocoa calls
  • Previous by thread: Re: Prevent default alert when quitting app w/ many unsaved docs
  • Next by thread: Re: Passing numbers through userdata
  • Index(es):
    • Date
    • Thread