## Labels

A label widget is a widget that displays some text or bitmap but cannot be clicked on or interacted with by the user. In addition to "simple" label widgets, other widgets such as buttons or menus can as well carry labels. Generally a label is for informational purposes, such as saying what the program title is, or what the widget is supposed to be used for. Some widgets carry predefined labels; the list of predefined labels is:

char *SX_Dialog_Label[] = {"Yes", "Cancel", "No", "Okay", "Cancel", "Retry" };

The pointers to these labels can be reassigned to other string pointers, so as (e.g.) to provide translations into other languages.

Widget MakeLabel(char *txt);

This function creates a label that contains the text in the character string pointed to by "txt". The text will simply be displayed, with no fancy borders or special highlighting. If the text contains new line characters, they will be interpreted properly.

If the argument txt is NULL, then no label will be set for the widget. This is convienent if you plan to put a bitmap on this widget with the SetWidgetBitmap() function.

This widget is useful for displaying a piece of textual information like a filename or user name.

If this routine fails, a NULL is returned.

SEE ALSO : SetWidgetPos() , SetWidgetBitmap() , SetLabel(), SetWidgetFont() , SetFgColor() , SetBgColor() , SetBorderColor()

void SetLabel(Widget w, char *txt);

This function sets the widget's text to the character string pointed to by "txt". The widget makes a private copy, so the "txt" pointer may be freed afterwards.

The new string may be truncated to the right if it is longer than the original. The simplest workaround is to pad the initial string with blanks at creation time.

This function also works with widgets created by MakeButton() and MakeToggle().

SEE ALSO : MakeLabel() , MakeButton() , MakeToggle() , SetWidgetFont()