battle@alphard.cs.utk.edu (David Battle) (01/04/90)
I just compiled the examples from Doug Young's Xt book on my DecStation 3100. Of the ones I have tried, most seem to work. I am having trouble, however, with the one that uses command-line specified resources. It is ch3/rmtest2.c. Here is the relevant part of the code: #include <X11/Intrinsic.h> #include <X11/StringDefs.h> typedef struct { Pixel fg, bg; int delay; Boolean verbose; } ApplicationData, *ApplicationDataPtr; static XtResource resources[] = { { "delay", "Delay", XtRInt, sizeof (int), XtOffset(ApplicationDataPtr, delay), XtRString, "2" }, { "verbose", "Verbose", XtRBoolean, sizeof (Boolean), XtOffset(ApplicationDataPtr, verbose), XtRString, "False"}, }; XrmOptionDescRec options[] = { {"-verbose", "*verbose", XrmoptionNoArg, "True"}, {"-delay", "*delay", XrmoptionStickyArg, NULL} }; main(argc, argv) int argc; char *argv[]; { Widget toplevel; ApplicationData data; toplevel = XtInitialize(argv[0], "Rmtest", options, XtNumber(options), &argc, argv); /* Retrieve the application resources. */ XtGetApplicationResources(toplevel, &data, resources, XtNumber(resources), NULL, 0); /* Print the results. */ printf("fg = %d, bg = %d, delay = %d, verbose = %d\n", data.fg, data.bg, data.delay, data.verbose); } This complies and loads fine, but when I try to run it and use the "-delay" option, I get errors from Xt. I have tried every way I can think of (using -delay rather than -xrm "delay: 5"). Here is what happens: % rmtest2 -delay5 X Toolkit Warning: Cannot convert string "-delay5" to type Integer fg = 0, bg = 2, delay = 2, verbose = 0 % rmtest2 -delay 5 X Toolkit Warning: Cannot convert string "-delay" to type Integer fg = 0, bg = 2, delay = 2, verbose = 0 % rmtest2 -xrm "*delay: 5" fg = 0, bg = 2, delay = 5, verbose = 0 The last one works OK, but I want to know why the first one doesn't. Isn't that the way it should look with a XrmoptionStickyArg? -David L. Battle battle@battle.esd.ornl.gov battle@utkux1.utk.edu
asente@decwrl.dec.com (Paul Asente) (01/04/90)
In article <1530@utkcs2.cs.utk.edu> battle@alphard.cs.utk.edu (David Battle) writes: >I just compiled the examples from Doug Young's Xt book on my DecStation >3100. Of the ones I have tried, most seem to work. I am having trouble, >however, with the one that uses command-line specified resources. It is >ch3/rmtest2.c. There seems to be a bug in the DECwindows implementation XrmParseCommand, causing XrmoptionStickyArg arguments not to work. If you change the command specification to be an XrmoptionSepArg, you should be able to specify the option as a separate argument with no problems. -paul asente asente@decwrl.dec.com decwrl!asente