Contents Previous Next Subchapters

Using Text Labels In A Dialog Window
See Also textfield

Description
Dialog "label" controls are used to display text information and do not accept user input.

addcontrol(
captiongeometry, "label", text)
Adds a "label" control, with the specified geometry , to the Dialog window specified by caption . The character row vector text specifies the text that is initially placed in the label control. The return value is the handle for the label control.

setcontrol(
handletext)
Changes the text displayed in the "label" control specified by handle to the value specified text, where handle is the value returned by addcontrol when the "label" control was created and text is a character row vector. The return value of setcontrol is true, if the control can be set as requested, and false otherwise.

Example
The following program creates a dialog window with two lines of text. It waits three seconds and then changes the text in the second line. You can close the window using its menu caption bar.

clear
#
Caption  = "Test Dialog"
geometry = [100, 100, 200, 100]
callback = "delwin(Caption);"
adddialog(Caption, geometry, callback);
#
geometry = [20, 20, 100, 20]
text     = "Line one"
addcontrol(Caption, geometry, "label", text);
#
geometry = [20, 40, 100, 20]
text     = "Line two"
handle = addcontrol(Caption, geometry, "label", text);
#
sleep(3)
setcontrol(handle, "Line 2");