Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!decwrl!adobe!hawley From: hawley@adobe.COM (Steve Hawley) Newsgroups: comp.sys.mac.programmer Subject: Re: CDEFs in THINK C Message-ID: <10563@adobe.UUCP> Date: 31 Jan 91 16:50:35 GMT References: <3006.27a67d21@iccgcc.decnet.ab.com> Reply-To: hawley@adobe.UUCP (Steve Hawley) Organization: Adobe Systems Incorporated, Mountain View Lines: 43 In article <3006.27a67d21@iccgcc.decnet.ab.com> milikich@iccgcc.decnet.ab.com (Mike Milikich, Allen-Bradley Company) writes: > I am trying to write a couple of custom CDEFs in THINK C for some >process control applications. Can anyone point me to or give me some examples >of simple CDEFs written in THINK C? Yes -- there used to be a simple CDEF example that was available from the sumex archives (sumex.stanford.edu). It was a CDEF that defined arbitrarily scalable push-on/push-off buttons. It is fairly limited in its capability, but it wasn't meant to be used as anything but a launching point for others. I should know, I wrote it. I forget where it was stashed. It's either in the tech subdirectory or the sources/c subdirectory. If you can't find it, sit down and try to do it on your own. The best way to approach this is to first write a shell application that creates one (or more) controls of a standard type that is closest to what you want to do and then performs *EVERY* possible action in some form or another on the control. With that done, start work on your CDEF and test it with the shell application. The basic structure (in Think C) will be this: pascal main(theCtl, message, param) /* I think these are the args -- I don't have IM-I handy right now */ ControlHandle theCtl; short message; long param; { /* you may have to do a SetUpA5() type thing */ switch(message) { case ... /* these will be draw messages or set/get messages etc */ case ... } } Obviously, I'm being too sketchy right now since I don't have IM in front of me. Just slog through it. It's really not too hard, just time consuming. Steve Hawley hawley@adobe.com -- "Did you know that a cow was *MURDERED* to make that jacket?" "Yes. I didn't think there were any witnesses, so I guess I'll have to kill you too." -Jake Johansen