[comp.windows.x] Specifying resource in resource file

paul@tredysvr.Tredydev.Unisys.COM (Paul Siu) (10/24/90)

I have problems specifying resource in a resource file.  For the following
simple program I have listed below, I placed a resource file under the pathname:
/lib/X11/app-defaults/Goodbye.  The resource file is loaded when the application
goodbye is run, but resource database can't seem to match the resource I have
listed in the resource file.  The program is in OpenLook.

For the sample program below, I specified in the Goodbye resource file:

Goodbye*button*XtNlabel: Goodbye

This did not work.  In fact, nothing else I tried worked except:

*label: Goodbye

Can someone please explain to me how one specifies resource in database.  I am
reading Young's book, but his examples does not help.   I thank you for any
help.

Paul Siu
paul@tredysvr.Tredydev.Unisys.COM

----------------------------- The simple program ----------------------------
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <X11/Xatom.h>
#include <Xol/OpenLook.h>
#include <Xol/OblongButt.h>

void quit_button();


void main (int argc, char *argv)
   {
   Widget toplevel, button;

   /* Initialize display connection */
   toplevel = OlInitialize(argv[0], "Goodbye", NULL, 0, &argc, argv);

   /* Create and manage the Oblong button */
   button = XtCreateManagedWidget("button", oblongButtonWidgetClass,
            toplevel, NULL, 0);

   /* Add Callback to the Oblong button */
   XtAddCallback(button, XtNselect, quit_button, NULL);

   /* Realize the Widget so it will be displayed */
   XtRealizeWidget(toplevel);

   /* Enter Event Loop */
   XtMainLoop();
   }


/*--------------------------------------------------------------------------
 * quit_button() - Handles callbacks for the button
 */
void quit_button(Widget w, caddr_t client_data, caddr_t *call_data)
   {
   /* Close the display so all of the Xserver's resources are freed */
   XtCloseDisplay(XtDisplay(w));
   exit(0);
   }

converse@EXPO.LCS.MIT.EDU (10/24/90)

> I specified in the Goodbye resource file:
>
> Goodbye*button*XtNlabel: Goodbye
>
> The program is in OpenLook.

The symbol XtNlabel is defined in StringDefs.h to be "label".
When you are writing application code and you want to reference the
resource named label, you refer to it as XtNlabel, as a convenience.
When you are writing resource files, StringDefs.h isn't operative,
isn't applicable, so you just name the resource itself.

Goodbye*button*label: Goodbye