Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!decwrl!sgi!shinobu!odin!news From: hajadi@goofy.csd.sgi.com (Ivan Hajadi) Newsgroups: comp.windows.x Subject: option description list Message-ID: <1991Apr16.173222.451@odin.corp.sgi.com> Date: 16 Apr 91 17:32:22 GMT Sender: news@odin.corp.sgi.com (Net News) Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 88 Can someone tell me what I did wrong ? I want to be able to call the program like this foo -label SOMETHING and have a label widget with string SOMETHING. Thanks. -- ivan #ifdef ATHENA #include #include #include #else #include #include #endif /* resources to use when there is no app-defaults file */ static char *fallback_resources[] = { #ifdef ATHENA "Foo*font: -adobe-helvetica-bold-r-normal--*-80-*-*-*-*-iso*-*", "Foo*Label.label: This is Athena label widget (no app-defaults)", #else "Foo*fontList: -adobe-helvetica-bold-r-normal--*-80-*-*-*-*-iso*-*", "Foo*XmLabel.labelString: This is Motif label widget (no app-defaults)", #endif NULL }; /* define command line option and resource file option */ static XrmOptionDescRec options[] = { #ifdef ATHENA {"-label", "*label.label", XrmoptionSepArg, NULL} #else {"-labelString", "*label.labelString", XrmoptionSepArg, NULL} #endif }; /* Application context takes care of the book-keeping necessary to */ /* maintain one or more connections to X servers. Every application */ /* must have at least one (default) application context. Application */ /* context is an opaque type, that is passed to other Xt functions. */ XtAppContext app_context; main(unsigned int argc, char **argv) { Widget toplevel, w; /* Convenient routine is XtInitialize */ toplevel = XtAppInitialize( &app_context /* returns application context */, "Foo" /* application class */, options /* command line option table */, XtNumber(options) /* number of options */, &argc, argv, fallback_resources /* resources to use when there is no app-defaults file */, NULL /* argument list used to override default values */, 0); #ifdef ATHENA w = XtCreateManagedWidget("label", labelWidgetClass, toplevel, NULL, 0); #else w = XtCreateManagedWidget("label", xmLabelWidgetClass, toplevel, NULL, 0); #endif XtRealizeWidget(toplevel); /* Convenient function is XtMainLoop */ XtAppMainLoop(app_context); } -- Ivan M. Hajadi, Widget - any small, unspecified hajadi@csd.sgi.com gadget or device (Webster)