Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HIViews vs NSViews



You might have some luck leaning on the objc runtime:
For any Objective C object, what you have is actually a pointer to
struct objc_object
   {
   struct objc_class *isa;
      /* …variable length data containing instance variable values…  */
   };

In the real world you never have an instance of NSView, but an instance of a subclass of NSView. I suppose you could use objc_getClassList to get all loaded classes, iterate over them to find those that are subclasses of NSView and stash away all of those values. If ((struct objc_object*)my_magic_pointer)->isa is equal to any of those values then there is a reasonable chance that what you've got is an instance of that class. This of course assumes that the thing you've got is actually a pointer.

Fred


On 30 Aug 2007, at 13:59, Mike Kluev wrote:

What's the best way to distinguish between ControlRef vs NSView* at runtime?
IsValidControlHandle/HIViewIsValid?


Mike


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/frederick.cheung% 40gmail.com


This email sent to email@hidden

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >HIViews vs NSViews (From: Mike Kluev <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.