home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / windows / x / motif / 8258 < prev    next >
Encoding:
Text File  |  1992-12-30  |  2.1 KB  |  67 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!fauern!uni-erlangen.de!cip.informatik.uni-erlangen.de!fkmunker
  2. From: fkmunker@cip.informatik.uni-erlangen.de (Frank Munkert)
  3. Newsgroups: comp.windows.x.motif
  4. Subject: Re: Label Widget HELP!!
  5. Date: Wed, 30 Dec 1992 09:10:20 GMT
  6. Organization: CSD., University of Erlangen
  7. Distribution: inet
  8. Message-ID: <1hrp1sEINN98k@uni-erlangen.de>
  9. References: <1992Dec29.165336.719@uoft02.utoledo.edu>
  10. NNTP-Posting-Host: faui00a.informatik.uni-erlangen.de
  11. Lines: 54
  12.  
  13. dsriniv@uoft02.utoledo.edu writes:
  14.  
  15. >I am learning X-Windows (Motif) and trying to change the 
  16. >resources of a label widget for a simple sample program
  17. >which just displays the label in a window. I am trying
  18. >to center the label string (which is of 3 lines) where
  19. >each line should be in the center of the window. But it is
  20. >getting left justified. I also don't know where to keep
  21. >the resource file for my label widget i.e which directory.
  22.  
  23. Try this:
  24.  
  25.  
  26. 1. Compile and link the following program:
  27.  
  28.   #include <Xm/Label.h>
  29.  
  30.   Widget appshell, the_label;
  31.  
  32.   void main (argc, argv)
  33.   int argc;
  34.   char *argv[];
  35.   {
  36.     appshell = XtInitialize (argv[0], "LabelTest", NULL, 0, &argc, argv);
  37.     the_label = XmCreateLabel (appshell, "TheLabel", NULL, 0);
  38.     XtManageChild (the_label);
  39.     XtRealizeWidget (appshell);
  40.     XtMainLoop ();
  41.     exit (0);
  42.   }
  43.  
  44.  
  45. 2. Create a resource file with the name "LabelTest" and the following content:
  46.  
  47.   *TheLabel.labelString: First line\nThe Second line\n3rd line
  48.  
  49. and put the resource file in a directory, say $HOME/test/app-defaults.
  50.  
  51. 3. Now assign the name of this directory + "/%N" to the environment variable
  52.    XUSERFILESEARCHPATH:
  53.  
  54.   setenv XUSERFILESEARCHPATH ${HOME}/test/app-defaults/%N
  55.  
  56. 4. Run the program; it should display the Label widget with three centered
  57. lines.
  58.  
  59. Greetings,
  60.   Frank (fkmunker@cip.informatik.uni-erlangen.de)
  61.  
  62. ---
  63. Frank Munkert            |  Uni Erlangen
  64. Zum Froschbruecklein 5   |  
  65. 8500 Nuernberg 10        |  <fkmunker@cip.informatik.uni-erlangen.de>
  66. Germany                  |  or: <fmu@pki-nbg.philips.de>
  67.