[comp.windows.x] Newline character in labelString

alleyne@teecs.UUCP (Adrian Alleyne) (09/25/90)

I am trying to create a label that has an imbedded newline character. eg.
    
    Line One Of Label
       Line Two:

If I use the following it works ok.

  XtSetArg (arglist[n], XmNlabelString, XmStringCreateLtoR 
               ("Line One Of Label \n Line Two:", 
                XmSTRING_DEFAULT_CHARSET));

Problem - How can I insert a newline character into the resource file?
          Note the following does NOT work: 

         *LABEL_NAME.labelString: "Line One Of Label \n Line Two:"

Thanks in advance,

----------------------------------------------------------------------
Adrian Alleyne                                  email: alleyne@teecs.UUCP
Litton Systems Canada Limited                   voice: (416) 249-1231
Etobicoke, Ont.                             
Canada M9W 5A7

converse@EXPO.LCS.MIT.EDU (09/28/90)

> Problem - How can I insert a newline character into the resource file?
>           Note the following does NOT work: 
> 
>          *LABEL_NAME.labelString: "Line One Of Label \n Line Two:"


According to the 2nd edition of the Digital Press refernece book on Xlib,
section 10.11.3.1, "Storing into a Resource Database":

	To allow values to contain arbitrary octets, the 4-character
	sequence \nnn, where n is a digit in the range of "0"-"7", is
	recognized and replaced with a single byte that contains this 
	sequence interpreted as an octal number.


So try
	  *LABEL_NAME.labelString: Line One Of Label \012 Line Two:

gerday@shell.COM (09/28/90)

I'm sorry if this solution has already been mentioned, but what
I like to use for multi-line labels is the same syntax as is
used for translation table continuation, i.e. "\n\"

ex: in my app-defaults file for xmh I have

Xmh*commandBox.button1.label:  Close\n\Window

which makes the button like this  ----------
                                  | Close  |
                                  | Window |
                                  ----------

Alternatively the same layout can be specified like this:

Xmh*commandBox.button1.label:  	Close\n\
				Window

I hope this helps.

---------------------------------------------------------------
Jan Gerday	    << C'etait chouette... on a bien rigole! >>
gerday@shell.com   			- Petit Nicolas

..!{sun,psuvax1,bcm,rice,decwrl,cs.utexas.edu}!shell!gerday
Consultant to:
Shell Development Company, Bellaire Research Center
P.O. Box 481, Room 4202, Houston, TX 77001