Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
markb77@gmail.com writes: > I've got a question about object programming technique in IDL. I've > started writing objects that extend the functionality of object > graphics.. for instance objects that are subclasses of IDLgrImage. > These work well. > > Now, I'm tempted to start organizing my data into objects as well. > This is a widget program with a large amount of different types of > data, and rather than keep everything in the info structure I could > imagine organizing most of it into several objects that I could keep > in the info structure. > > Is this normal object programming technique? Do people do this? This is certainly possible, but still requires special steps to pass data around. What I have done is made all the widgets objects, and in particular, subclassed IDL_Container objects. Then, passing data objects around is simply a matter of adding them to the appropriate widget object, usually either the top-level base object or a draw object. Draw objects, in fact, don't know anything at all about what they are drawing. They just call the DRAW method on any object inside them, in the order in which they have been added to the draw object. This allows me, for example, to put annotation objects on top of image objects, and turn annotations on and off, move them around, etc. My "dumb" draw widget objects just draws when they are told to. :-) I've also subclassed the IDL_Container object so I can get objects out of it by name. This makes it easy to put objects in containers, move them around, and delete them when I am finished with them. Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting, Inc. Coyote's Guide to IDL Programming: http://www.dfanning.com/