Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!infonode!doyle From: doyle@infonode.ingr.com (Doyle Davidson) Newsgroups: comp.windows.x Subject: Easy XtSetArg Message-ID: <1991May3.190658.10560@infonode.ingr.com> Date: 3 May 91 19:06:58 GMT Organization: Intergraph Corp. Huntsville, AL Lines: 50 Here is a set of macros that I use to make XtSetArg life easier. There is an assertion to make sure that you don't exceed the array size. It works for both C and C++. Enjoy! Doyle ---------------------------------- cut here ----------------------- /* * * Author: Doyle C. Davidson * Intergraph Corporation * One Madison Industrial Park * Huntsville, Al. 35894-0001 * * My macros for using XtSetArg easily: * Usage: * * blah() * { * DeclareArgs(2); * ... * FirstArg(XmNx, 100); * NextArg(XmNy, 80); * button = XmCreatePushButton(parent, name, Args, ArgCount); * } */ #define ArgCount _fooArgCount #define Args _fooArgList #define ArgCountMax _fooArgCountMax #define DeclareArgs(n) Arg Args[n]; int ArgCountMax = n; int ArgCount #define FirstArg(name, val) \ { XtSetArg(Args[0], (name), (val)); ArgCount=1;} #define NextArg(name, val) \ { assert(ArgCount < ArgCountMax); \ XtSetArg(Args[ArgCount], (name), (val)); ArgCount++;} ---------------------------------- end here ----------------------- ------------------------------------------------------------------ Doyle C. Davidson | Intergraph Corp. | These comments are... Workstation Graphics Standards | 1 Madison Industrial Park | Huntsville, AL 35806 | (205) 730-2000 | X-clusively my own. | ..!uunet!ingr!doyle | ------------------------------------------------------------------