Determining if an Object has a Method

QUESTION: Is there a way to determine at run-time if an object has a particular method associated with it?

ANSWER: There is no direct way to do so, but Jim Pendleton of RSI has written a couple of routines that parse output from Routine_Info to do so. The only caveat is that the object method must have been compiled in that session for this method to work. (This is not normally a problem, although it sometimes comes up for an object that has been restored from a save file.)

You can find Jim's routines ClassHasMethod and ObjectHasMethod on the RSI User Contribution web page.

Note: In IDL 6.4, the Obj_HasMethod function was introduced into IDL itself, and is now the preferred way to determine if an object has a method.

Web Coyote's Guide to IDL Programming