#! /usr/sgitcl/bin/moat xtAppInitialize xmLabel .lbl managed -labelString "Hello world!" . realizeWidget . mainLoopNote that text is broken into separate lines only if you put newline symbols in it. Text may contains non-ASCII characters, using the encoding defined in the current font, usually ISO 8859-1.
This example shows more complex use of label widgets:
#! /usr/sgitcl/bin/moat xtAppInitialize xmLabel .lbl managed .lbl setValues -labelString { If your text contains newline symbols,\n it will be broken into separate lines.\n It may contain non-ASCII characters (àçéñôßü) } .lbl setValues \ -stringDirection string_direction_r_to_l \ -alignment alignment_end \ -fontList -*courier-bold-r-*--18-* \ -marginLeft 10 -marginWidth 10 \ -x 200 -y 100 . realizeWidget . mainLoopTable 4-18 shows the resources for xmLabel.
Some resources are used only in derived classes. When displayed text material changes, the size of the label may or may not be recomputed, depending on -recomputeSize. The label may display the -labelString or -labelPixmap resource, depending on the -labelType value. Labels are always centered top and bottom (inside their margins), but may be centered or left or right justified, depending on -alignment.
When a label is inactive (insensitive), the displayed text is grayed using a 50% pattern. You can change this pattern by specifying a pixmap with -label-Insensitive-Pixmap.
Table 4-19 lists resources inherited from the Primitive and Core classes.
Labels do not define specific callbacks, but just inherit them from the Primitive class, namely helpCallback and destroyCallback.