Routines (alphabetical) > Routines: W > WIDGET_PROPERTYSHEET

# WIDGET_PROPERTYSHEET

The WIDGET_PROPERTYSHEET function creates a property sheet widget, which exposes the properties of an IDL object subclassed from the IDLitComponent class in a graphical interface. The property sheet widget must be a child of a base or tab widget, and it cannot be the parent of any other widget.

The IDLitComponent class was designed for use by the IDL iTools system. As a result, all IDLit* objects subclass from IDLitComponent, so properties of object classes written for the IDL iTools system can be displayed in a property sheet. In addition, most IDLgr* objects (some do not such as IDLgrFont, IDLgrPrinter, IDLgrPattern, and so on) subclass from IDLitComponent, which means that properties of standard IDL graphics objects can be displayed in a property sheet even if the rest of the iTools framework is not in use.

In order to be shown in a property sheet, object properties must be registered and visible. In addition, in order for property values shown in a property sheet to be editable by the user, the property must be sensitive.

The name of the changed property is placed into an IDL event, and the object is updated when this event is processed. An existing property sheet can also be assigned a new component, causing it to reload with the new list of properties and their values.

### Property Sheet Widget Data Types and Controls

The following controls are available for the corresponding data types in property sheet widgets:

Data Type | Control
Boolean | Droplist with two choices: True or False
Number | One of the following: Edit control that accepts +, -, 0123456789, plus decimal points, e, E, d and D for floating point numbers. Slider Spinner
String | Text box, expandable when string length exceeds visible area.
Color | Color picker.
Line Style | Droplist displaying seven line style choices:
Line Thickness | Droplist displaying ten line thickness choices:
Symbol | Droplist displaying the symbol choices:
String list | Droplist displaying a list of strings.
User-Defined | Edit button linked to user-defined control (see User-defined Properties).

## Syntax

Result = WIDGET_PROPERTYSHEET(Parent [, /ALIGN_BOTTOM |, /ALIGN_CENTER |, /ALIGN_LEFT |, /ALIGN_RIGHT |, /ALIGN_TOP] [, /CONTEXT_EVENTS] [, /EDITABLE] [, EVENT_FUNC=STRING] [, EVENT_PRO=STRING] [, FONT=STRING] [, FRAME=width] [, FUNC_GET_VALUE=STRING] [, /HIDE_ADVANCED_ONLY] [, IGNORE_ACCELERATORS=value] [, KILL_NOTIFY=STRING] [, /MULTIPLE_PROPERTIES] [, /NO_COPY] [, NOTIFY_REALIZE=STRING] [, PRO_SET_VALUE=STRING] [, SCR_XSIZE=width] [, SCR_YSIZE=height] [, /SENSITIVE] [, /SUNKEN_FRAME] [, /TRACKING_EVENTS] [, UNAME=STRING] [,UNITS={0 | 1 | 2}] [, UVALUE=VALUE] [, VALUE=VALUE] [, XOFFSET=VALUE] [, XSIZE=VALUE] [, YOFFSET=VALUE] [, YSIZE=VALUE])

## Return Value

The returned value of this function is the widget ID of the newly-created property sheet widget.

## Arguments

### Parent

The widget ID of the parent for the new property sheet widget. Parent must be a base or tab widget.

## Keywords

### ALIGN_BOTTOM

Set this keyword to align the new widget with the bottom of its parent base. To take effect, the parent must be a ROW base.

### ALIGN_CENTER

Set this keyword to align the new widget with the center of its parent base. To take effect, the parent must be a ROW or COLUMN base. In ROW bases, the new widget will be vertically centered. In COLUMN bases, the new widget will be horizontally centered.

### ALIGN_LEFT

Set this keyword to align the new widget with the left side of its parent base. To take effect, the parent must be a COLUMN base.

### ALIGN_RIGHT

Set this keyword to align the new widget with the right side of its parent base. To take effect, the parent must be a COLUMN base.

### ALIGN_TOP

Set this keyword to align the new widget with the top of its parent base. To take effect, the parent must be a ROW base.

### CONTEXT_EVENTS

Set this keyword to cause context menu events (or simply context events) to be issued when the user clicks the right mouse button over the widget. Set the keyword to 0 (zero) to disable such events. Context events are intended for use with context-sensitive menus (also known as pop-up or shortcut menus); pass the context event ID to the WIDGET_DISPLAYCONTEXTMENU procedure within your widget program’s event handler to display the context menu.

For more on detecting and handling context menu events, see Context-Sensitive>Menus.

Note: With regard to /CONTEXT_EVENTS, the Motif and Windows version of the property sheet differ very slightly. In the Motif version, individually desensitized cells cannot generate context events, though their row label can.

### EDITABLE

Set this keyword to 0 (zero) to mark a property sheet as read-only. Property sheet widgets are editable by default (EDITABLE=1). In this default mode, property values can be modified. When a property sheet is marked as read-only (EDITABLE=0), you can select properties and use any scrollbars, but cannot change any values. Setting this keyword to 0 is roughly equivalent to desensitizing all properties by setting the SENSITIVE attribute of every property on the property sheet equal to 0.

Three things that determine the appearance of a property sheet data cells are, in order of greatest to least precedence:

1. Sensitivity of the entire widget — If SENSITIVE=0 for WIDGET_PROPERTYSHEET then no selection or scrolling is possible.
2. Editability of the entire widget — If EDITABLE=0 for the property sheet (meaning it is marked as read-only), cells can be selected but cannot be changed. If EDITABLE=1 (the default value meaning properties can be selected and modified), then the editability of individual properties is controlled by their individual sensitivity values.
3. Sensitivity of an individual property — If SENSITIVE=0 for an individual property (set using the RegisterProperty or SetPropertyAttribute methods of IDLitComponent), then the individual property cannot be selected or changed.

Note: To set the SENSITIVE attribute of individual properties within a property sheet, use IDLitComponent::RegisterProperty or IDLitComponent::SetPropertyAttribute.

### EVENT_FUNC

A string containing the name of a function to be called by the WIDGET_EVENT function when an event arrives from a widget in the widget hierarchy rooted at the newly-created widget.

### EVENT_PRO

A string containing the name of a procedure to be called by the WIDGET_EVENT function when an event arrives from a widget in the widget hierarchy rooted at the newly-created widget.

### FONT

The name of the font to be used by the widget. The font specified is a device font (an X Windows font on Motif systems; a TrueType or PostScript font on Windows systems). See “About Device Fonts” in Appendix I of the IDL Reference Guide manual for details on specifying names for device fonts. If this keyword is omitted, the default font is used.

Note: On Microsoft Windows platforms, if FONT is not specified, IDL uses the system default font. Different versions of Windows use different system default fonts; in general, the system default font is the font appropriate for the version of Windows in question.

### FRAME

The value of this keyword specifies the width of a frame in units specified by the UNITS keyword (pixels are the default) to be drawn around the borders of the widget. Note that this keyword is only a “hint” to the toolkit, and may be ignored in some instances. If SUNKEN_FRAME is also set, FRAME is ignored.

### FUNC_GET_VALUE

A string containing the name of a function to be called when the GET_VALUE keyword to the WIDGET_CONTROL procedure is called for this widget. Using this technique allows you to change the value that should be returned for a widget. Compound widgets use this ability to define their values transparently to the user.

### HIDE_ADVANCED_ONLY

Set this keyword to 1 to only display simple properties (properties that do not have the ADVANCED_ONLY attribute set). The default behavior is to display all properties.

### IGNORE_ACCELERATORS

Set this keyword to specify what WIDGET_BUTTON accelerators are to be ignored when this propertysheet widget has keyboard focus. Valid values are:

- A string or string array containing any value that is legal for WIDGET_BUTTON’s ACCELERATOR keyword
- The number 1, indicating all accelerators should be ignored

Ordinarily, accelerators are processed before keyboard events reach the widget that has the keyboard focus. Consider a case where the accelerator “Ctrl+V” has been mapped to a button that allows the user to paste objects copied from one drawing area into another. In an application that also has a propertysheet, attempting to use Ctrl+V to paste text into the propertysheet would fail as this event would be stolen by the accelerator. Setting IGNORE_ACCELERATORS to “Ctrl+V” allows a propertysheet widget with an editable text area to receive keyboard events instead of the button with a conflicting accelerator. Once the propertysheet text field loses focus, all specified accelerators are automatically re-enabled.

See Disabling Button Widget Accelerators for usage details and examples.

### KILL_NOTIFY

Set this keyword to a string that contains the name of a procedure to be called automatically when the specified widget dies. Each widget is allowed a single such “callback” procedure. It can be removed by setting the routine to an empty string (`''`).

The callback routine is called with the widget identifier as its only argument. At that point, the widget identifier can only be used with the WIDGET_CONTROL procedure to get or set the user value. All other requests that require a widget ID are disallowed for the target widget. The callback is not issued until the WIDGET_EVENT function is called.

### MULTIPLE_PROPERTIES

Set this property to 1 to allow multiple properties to be selected at the same time. When this keyword is set, you can hold down the Ctrl key while left-clicking with the mouse to make nonadjacent selections, or hold down the Shift key to select an adjacent range of properties in a property sheet. Set this property to 0 (zero) to disallow multiple property selection. This is the default. See Selecting Properties for more information.

### NO_COPY

Usually, when setting or getting widget user values, either at widget creation or using the SET_UVALUE and GET_UVALUE keywords to WIDGET_CONTROL, IDL makes a second copy of the data being transferred. Although this technique is fine for small data, it can have a significant memory cost when the data being copied is large.

If the NO_COPY keyword is set, IDL handles these operations differently. Rather than copy the source data, it takes the data away from the source and attaches it directly to the destination. This feature can be used by compound widgets to obtain state information from a UVALUE without all the memory copying that would otherwise occur. However, it has the side effect of causing the source variable to become undefined. During a set operation (using the UVALUE keyword to WIDGET_BASE or the SET_UVALUE keyword to WIDGET_CONTROL), the variable passed as value becomes undefined. During a get operation (GET_UVALUE keyword to WIDGET_CONTROL), the user value of the widget in question becomes undefined.

### NOTIFY_REALIZE

Set this keyword to a string that contains the name of a procedure to be called automatically when the specified widget is realized. This callback occurs just once (because widgets are realized only once). Each widget is allowed a single such callback procedure. It can be removed by setting the routine to an empty string (`''`). The callback routine is called with the widget ID as its only argument.

### PRO_SET_VALUE

A string containing the name of a procedure to be called when the SET_VALUE keyword to the WIDGET_CONTROL procedure is called for this widget. See the description of the PRO_SET_VALUE keyword to WIDGET_CONTROL for information on using this keyword.

### SCR_XSIZE

Set this keyword to the desired screen width of the widget, in units specified by the UNITS keyword (pixels are the default). If neither XSIZE nor SCR_XSIZE is specified, then the property sheet widget will be naturally sized based on the width of cell contents. See Property Sheet Sizing for details.

### SCR_YSIZE

Set this keyword to the desired screen height of the widget, in units specified by the UNITS keyword (pixels are the default). If neither YSIZE nor SCR_YSIZE is specified, the property sheet will use a default height. This default is based on the number of rows: 10, or the number of visible properties, whichever is less.

### SENSITIVE

Set this keyword to control the initial sensitivity state of the widget.

If SENSITIVE is zero, the widget becomes insensitive. If nonzero, it becomes sensitive. When a widget is sensitive, it has normal appearance and can receive user input. For example, a sensitive button widget can be activated by moving the mouse cursor over it and pressing a mouse button. When a widget is insensitive, it indicates the fact by changing its appearance, looking disabled, and it ignores any input.

Sensitivity can be used to control when a user is allowed to manipulate the widget.

Note: Some widgets do not change their appearance when they are made insensitive, but they cease generating events.

After creating the widget hierarchy, you can change the sensitivity state using the SENSITIVE keyword with the WIDGET_CONTROL procedure.

### SUNKEN_FRAME

Set this keyword to create the appearance of a three-dimensional, beveled border around the property sheet widget. This makes the widget appear slightly inset. If the FRAME keyword is also set, SUNKEN_FRAME overrides the setting, and the frame's width will be the minimum necessary to give the appearance of indentation.

### TRACKING_EVENTS

Set this keyword to cause widget tracking events to be issued for the widget whenever the mouse pointer enters or leaves the region covered by that widget. For the structure of tracking events, see “TRACKING_EVENTS” in the IDL Reference Guide manual in the documentation for WIDGET_BASE.

### UNAME

Set this keyword to a string that can be used to identify the widget in your code. You can associate a name with each widget in a specific hierarchy, and then use that name to query the widget hierarchy and get the correct widget ID.

To query the widget hierarchy, use the WIDGET_INFO function with the FIND_BY_UNAME keyword. The UNAME should be unique to the widget hierarchy because the FIND_BY_UNAME keyword returns the ID of the first widget with the specified name.

### UNITS

Set this keyword to specify the units used when supplying measurements or position values. Set UNITS equal to 0 (zero) to specify that all measurements are in pixels (this is the default), to 1 (one) to specify that all measurements are in inches, or to 2 (two) to specify that all measurements are in centimeters. This keyword does not change the units used in a widget event structure or in most of the fields of the geometry structure returned by WIDGET_INFO.

### UVALUE

The user value to be assigned to the widget. Each widget can contain a user-specified value of any data type and organization. This value is not used by the widget in any way, but exists entirely for the convenience of the IDL programmer. This keyword allows you to set this value when the widget is first created.

If UVALUE is not present, the widget’s initial user value is undefined.

The user value for a widget can be accessed and modified at any time by using the GET_UVALUE and SET_UVALUE keywords to the WIDGET_CONTROL procedure.

### VALUE

Set this keyword to the object reference or array of object references to objects that subclass from the IDLitComponent class. Registered properties of the specified objects will be displayed in the property sheet.

If a single object reference is supplied, the property sheet will have a single column containing the object’s properties. If an array of object references is supplied, the property sheet will have multiple columns.

Note: Due to limitations of the user interface controls that underlie the property sheet widget, a property sheet can display properties for at most 100 component objects.

Note: All object references must be to objects of the same type.

If no object references are supplied, the property sheet will initially be empty. Object references can be loaded into an existing property sheet using the SET_VALUE keyword to WIDGET_CONTROL. Whenever the value is set, via SET_VALUE, the property sheet widget is loaded with the registered, visible properties of the new component. Setting the value to a null object will clear the property sheet widget. A null object can be created by calling the OBJ_NEW function without any arguments:

nullObject = OBJ_NEW()

### XOFFSET

The horizontal offset of the widget in units specified by the UNITS keyword (pixels are the default) relative to its parent.

Specifying an offset relative to a row or column major base widget does not work because those widgets enforce their own layout policies. This keyword is primarily of use relative to a bulletin board base widget. Note that it is best to avoid using this style of widget layout.

### XSIZE

The widget width, measured in average character widths of the widget's font. This value includes the row label, but does not include any vertical scrollbar or frame thickness. If neither XSIZE nor SCR_XSIZE is specified, then the property sheet widget will be naturally sized based on the width of cell contents. See Property Sheet Sizing for details.

### YOFFSET

The vertical offset of the widget in units specified by the UNITS keyword (pixels are the default) relative to its parent. This offset is specified relative to the upper left corner of the parent widget.

Specifying an offset relative to a row or column major base widget does not work because those widgets enforce their own layout policies. This keyword is primarily of use relative to a bulletin board base widget. Note that it is best to avoid using this style of widget layout.

### YSIZE

The desired height of the widget, in number of visible properties. The ultimate height of the property sheet in pixels will include the heights of the column header, the possible horizontal scrollbar, and any frame. If neither YSIZE nor SCR_YSIZE is specified, the property sheet will use a default height. This default is based on the number of rows: 10, or the number of visible properties, whichever is less.

## Keywords to WIDGET_CONTROL

A number of keywords to the WIDGET_CONTROL affect the behavior of property sheet widgets. In addition to those keywords that affect all widgets, the following keywords are particularly useful: CONTEXT_EVENTS, EDITABLE, IGNORE_ACCELERATORS, MULTIPLE_PROPERTIES, PROPERTYSHEET_SETSELECTED, REFRESH_PROPERTY.

## Keywords to WIDGET_INFO

Some keywords to WIDGET_INFO return information that applies specifically to property sheet widgets. In addition to those keywords that apply to all widgets, the following keywords are particularly useful: COMPONENT, CONTEXT_EVENTS MULTIPLE_PROPERTIES, PROPERTY_VALID, PROPERTY_VALUE, PROPERTYSHEET_NSELECTED, PROPERTYSHEET_SELECTED, STRING_SIZE.

## Widget Events Returned by Property Sheet Widgets

Several variations of the property sheet widget event structure depend upon the specific event being reported. All of these structures contain the standard three fields (ID, TOP, and HANDLER). The select and change events also include an integer TYPE field that indicates which type of structure has been returned or which type of event was generated. Programs should always check the TYPE field before referencing fields that are not present in all property sheet event structures, unless the CONTEXT_EVENTS keyword is set. When handling context menu events, the event structure name must be used instead of the TYPE field. The different property sheet widget event structures are described below.

### Change Event (TYPE=0)

This event is generated whenever the user enters a new value for a property. It is also used to signal that a user-defined property needs to be changed. The following statement defines the event structure returned by the WIDGET_EVENT function:

{WIDGET_PROPSHEET_CHANGE, ID:0L, TOP:0L, HANDLER:0L, TYPE:0L, COMPONENT:OBJREF, IDENTIFIER:"", PROPTYPE:0L, SET_DEFINED: OL}

The COMPONENT field contains an object reference to the object associated with the property sheet. When multiple objects are associated with the property sheet, this field indicates which object is to change.

The IDENTIFIER field specifies the value of the property’s identifier attribute. This identifier is unique among all of the component’s properties.

The PROPTYPE field indicates the type of the property (integer, string, etc.). The integer values for these types are:

6.0 | Introduced
6.1 | Added EDITABLE, FRAME, IGNORE_ACCELERATORS, MULTIPLE_PROPERTIES, and SUNKEN_FRAME keywords Added NSELECTED field to WIDGET_PROPSHEET_SELECT event structure Added ROW and COL fields to WIDGET_CONTEXT event structure

## See Also

About Property Sheet Widgets