Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!sgi!shinobu!odin!news From: hajadi@goofy.csd.sgi.com (Ivan Hajadi) Newsgroups: comp.windows.x.motif Subject: option desc, motif label, labeString, help ! Message-ID: <1991Apr16.173103.366@odin.corp.sgi.com> Date: 16 Apr 91 17:31:03 GMT Sender: news@odin.corp.sgi.com (Net News) Distribution: usa Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 77 /* * xappinit.c * * Example program to show how to use XtAppInitialize instead of the * convenient routine XtInitialize. It also shows how to use fallback * resources, and option description record. * * If the program cannot find /usr/lib/X11/app-defaults/Foo resource * file, then it will use what ever specified in fallback_resources. * Usually this fallback resource list contains crucial resource values * that are needed to run the program successfully. * * Options describes the form of command line option that this program * can handle. See p. 340 Vol One of the O'Reilly book for more * examples. * This program has this syntax: xappinit -labelString "". * * Ivan M. Hajadi, Silicon Graphics, Inc., 15-April-91 */ #include #include /* resources to use when there is no app-defaults file */ static char *fallback_resources[] = { "Foo*fontList: -adobe-helvetica-bold-r-normal--*-80-*-*-*-*-iso*-*", /* "Foo*XmLabel.labelString: This is Motif label widget (no app-defaults)", */ NULL }; /* define command line option and resource file option */ static XrmOptionDescRec options[] = { {"-labelString", "*label.labelString", XrmoptionSepArg, NULL} }; /* 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); w = XtCreateManagedWidget("label", xmLabelWidgetClass, toplevel, NULL, 0); XtRealizeWidget(toplevel); /* Convenient function is XtMainLoop */ XtAppMainLoop(app_context); } -- Ivan M. Hajadi, Widget - any small, unspecified hajadi@csd.sgi.com gadget or device (Webster)