WwSetValue Function

Sets the specified value for a given widget.

Usage

status = WwSetValue(widget, [value])

Input Parameters

widget — The ID of the widget whose value you want to set.

value — The value of the widget (optional when keywords are specified).

Returned Value

status — Returns 1 if the function is successful, or 0 if the function is not successful.

Keywords

Close — If present and nonzero, closes the widget hierarchy from the top-level shell down.

Display — If present and nonzero, displays the widget hierarchy from the top-level shell down.

Hide — If present and nonzero, hides the specified widget or group of widgets (layout).

Nonsensitive — If present and nonzero, sets the widget to nonsensitive.

Nopropagate — If nonzero, suppresses the propagation of the value of Userdata for children of the container widgets (Form, Board, Row/Column).

Position — If the widget is to be placed in a bulletin board layout, use this keyword to specify a 2-element array containing the x, y coordinates of the widget within the bulletin board (in pixels).

Scroll — (UNIX Only) Specifies a 2-element array containing the scroll position (x,y coordinates, in pixels) of a drawing area widget or a text widget. The widget must be displayed before the call to WwSetValue with the Scroll keyword is made. This keyword does not work on Windows.

Show — If present and nonzero, shows the specified widget or group of widgets (layout).

Sensitive — If present and nonzero, sets the widget to sensitive.

Size — A two-element array specifying the width and height of the specified widget.

Tab_Win — If this keyword is present and nonzero, the tab navigation feature is turned on for the supplied widget ID. If this keyword is set to zero, the tab navigation feature is turned off for the supplied widget ID.

Update — If present and nonzero, all pending exposure (i.e., window repair) events are processed immediately. If you suspect that a callback procedure will take a long time, use this keyword to update the display before starting the time consuming operation.

Userdata — Stores the specified variable with the widget. By default, the value of Userdata is also set (propagated) for all children of the container widgets (Form, Board, Row/Column). To suppress the propagation of the value of Userdata use the Nopropagate keyword. You can retrieve the value of Userdata later with WwGetValue.

Color/Font Keywords

Background — Specifies the background color name.

Font — Specifies the name of the font used for text.

MSFont — Adds support for Windows fonts.

Foreground — Specifies the foreground color name.

Attachment Keywords

Bottom — If a widget ID is specified (for example, Bottom=wid), then the bottom of the widget is attached to the top of the specified widget. If no widget ID is specified (for example, /Bottom), then the bottom of the widget is attached to the bottom of the parent widget.

Left — If a widget ID is specified (for example, Left=wid), then the left side of the widget is attached to the right side of the specified widget. If no widget ID is specified (for example, /Left), then the left side of the widget is attached to the left side of the parent widget.

Right — If a widget ID is specified (for example, Right=wid), then the right side of the widget is attached to the left side of the specified widget. If no widget ID is specified (for example, /Right), then the right side of the widget is attached to the right side of the parent widget.

Top — If a widget ID is specified (for example, Top=wid), then the top of the widget is attached to the bottom of the specified widget. If no widget ID is specified (for example, /Top), then the top of the widget is attached to the top of the parent widget.

Discussion

See the Get/Set Value section under each PV‑WAVE Widget function description to find out what value is set by WwSetValue for each function. For example, WwSetValue called with the ID of a list widget sets the current list of items to a specified string array of new items.

Example

The following example demonstrates two common uses of WwSetValue: displaying and closing widgets. In the callback routine CommandDone, WwSetValue is called to close the widget when the user selects the Close function from the window manager menu. In the Widget Commands section, WwSetValue is used to display the button box widget.

PRO CbuttonCB, wid, data
   command = WwCommand(wid, 'CommandOK', $
      'CommandDone', Position=[300, 300], $
      Title='Command Entry Window')
END
PRO CommandOK, wid, shell
   value = WwGetValue(wid)
   PRINT, value
END
PRO CommandDone, wid, shell
   status = WwSetValue(shell, /Close)
END

Widget Commands

top = WwInit('ww_ex34', 'Examples', layout)
button = WwButtonBox(layout, 'Command', 'CbuttonCB')
status = WwSetValue(top, /Display)
WwLoop

See Also

For detailed information on GUI development, refer to the PV‑WAVE Application Developer’s Guide.

For more information about how to write an application program based on PV‑WAVE Widgets, refer to Using Wave Widgets in the PV‑WAVE Application Developer’s Guide.

For additional information on the color and font keywords, see "Setting Colors and Fonts" in the PV‑WAVE Application Developer’s Guide.

For additional information on attachment keywords, see "Form Layout: Attachments" in the PV‑WAVE Application Developer’s Guide.