The C string "A Label" (which is 7 chars long, plus 1 NULL byte) is automatically converted into a compound
string by the toolkit using a pre−installed type converter. This method can also be used to change the label for a
widget using XtVaSetValues().
Since compound strings are dynamically created and destroyed, you cannot statically declare an argument list that
contains a pointer to a compound string. For example, it would be an error to do the following:
static Arg list[] = {
...
XmNlabelString, XmStringCreateLocalized ("A label"),
...
};
label = XtCreateManagedWidget ("name",
xmLabelWidgetClass, parent,
list, XtNumber (list));
This technique causes an error because you cannot create a compound string in a statically declared array. For a
complete discussion of compound strings, see Chapter 19, Compound Strings.
12.1.3 Images as Labels
A Label widget or gadget can display an image instead of text by setting the XmNlabelType resource to
XmPIXMAP. As a result of this resource setting, the Label displays the -pixmap specified for the XmNlabelPixmap
resource. the source code demonstrates how pixmaps can be used as labels. XtSetLanguageProc() is only
available in X11R5; there is no corresponding function in X11R4.
/* pixmaps.c −− Demonstrate simple label gadgets in a row column.
* Each command line argument represents a bitmap filename. Try
* to load the corresponding pixmap and store in a RowColumn.
*/
#include <Xm/LabelG.h>
#include <Xm/RowColumn.h>
main(argc, argv)
int argc;
char *argv[]; ...