Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!usc!ucsd!ucbvax!ALEX.CSS.GOV!lynnes From: lynnes@ALEX.CSS.GOV (Christopher Lynnes) Newsgroups: comp.windows.x.motif Subject: Re: XmString type converter Message-ID: <9101312334.AA05514@alex.CSS.GOV> Date: 31 Jan 91 23:34:50 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 56 >I have posted this question and have gotten no answer. Now I >want to post the question again and hope people outthere be >able to help me with this. > >This is a common problem with motif labelString. Resource manager >can't handle multiple line label string specified in resource file > You can add your own String->XmString converter. Here is a crude solution: #include #include #include void CvtXmString(args, cnt, from, to) XrmValuePtr *args; Cardinal cnt; XrmValuePtr from; XrmValuePtr to; { char *s = from->addr; static XmString xms; if (s == NULL) { to->size = 0; to->addr = (caddr_t)NULL; } else { xms = XmStringCreateLtoR(s, XmSTRING_DEFAULT_CHARSET); to->size = sizeof(XmString); to->addr = (caddr_t)&xms; } } Then, add this converter function after initializing the toolkit, but before you create your widgets (except for the toplevel one), like so: XtAddConverter(XtRString, XmRXmString, CvtXmString, NULL, 0); (You will need to include Xm.h and StringDefs.h here if you aren't already). Then, a resource specification looking like: TestUil*main.labelString: This is a test\nThis is only a test should do the trick (works for me). Chris Lynnes ===== : = ::::: Teledyne Geotech ===== :: == ::::: Alexandria, Virginia ::: === (703) 739-7316 :: == lynnes@seismo.CSS.GOV : =