milikich@iccgcc.decnet.ab.com (Mike Milikich, Allen-Bradley Company) (01/30/91)
Help! 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? I have read IM-I on writing your own CDEFs, and have also probably gleaned about as much useful info from the manual as I can. Personal replies are probably better than postings, but I'll take anything I can get! Thankyew... Mike : (Don't like the address below? Try milikich@odin.icd.ab.com). -------------------------------------------------------------------------------- | milikich%iccgcc.decnet@consrt.rok.com |"...and the men who hold high places | | allen-bradley company | must be the ones to start..." | | 747 alpha drive |--------------------------------------| | highland heights, ohio 44143 | I don't speak for A-B, | | (216) 646-3406 FAX : (216) 646-4343 | and I know they don't speak for me. | --------------------------------------------------------------------------------
hawley@adobe.COM (Steve Hawley) (02/01/91)
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