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 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:
- Sensitivity of the entire widget: If SENSITIVE=0 for WIDGET_PROPERTYSHEET then no selection or scrolling is possible.
- 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.
- 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 Using Device Fonts 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 keyword 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_EVENTSMULTIPLE_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:
0 |
USERDEF |
1 |
BOOLEAN |
2 |
INTEGER |
3 |
FLOAT |
4 |
STRING |
5 |
COLOR |
6 |
LINESTYLE |
7 |
SYMBOL |
8 |
THICKNESS |
9 |
ENUMLIST |
The SET_DEFINED field indicates whether or not an undefined property is having its value set. In most circumstances, along with its new value, the property should have its UNDEFINED attribute set to zero. If a property is never marked as undefined, this field can be ignored. See Changing Properties for more information.
Select Event (TYPE=1)
The select event is generated whenever the current row or column in the property sheet changes. Navigation between cells is performed by clicking on a cell. When the property sheet is realized, no properties are selected by default. However a single property or multiple properties can be selected programmatically using the PROPERTYSHEET_SETSELECTED keyword to the WIDGET_CONTROL procedure.
The following statement defines the event structure returned by the WIDGET_EVENT function:
{WIDGET_PROPSHEET_SELECT, ID:0L, TOP:0L, HANDLER:0L, TYPE:0L, COMPONENT:OBJREF, IDENTIFIER:"", NSELECTED:0L }
The COMPONENT tag is a reference to the object associated with the selected property value. When multiple objects (also known as components) are associated with the property sheet, this member indicates which one object had one of its property values selected. If a property (instead of a property value) is selected, the COMPONENT tag always contains an object reference to the first object, even if there are multiple objects in the property sheet.
The IDENTIFIER field specifies the value of the property’s identifier attribute. This identifier is unique among all properties of the component. When multiple selections are made, this field holds the identifier of the first item selected. This is not the first item selected with the mouse, but the first item encountered in the property sheet definition among those which are selected. To return the identifiers of all the selected properties, use WIDGET_INFO with the /PROPERTYSHEET_SELECTED keyword.
The NSELECTED field specifies the total number of currently selected properties. This is equivalent to calling WIDGET_INFO with /PROPERTYSHEET_NSELECTED. See Accessing Property Sheet Selection Events for more information.
Context Menu Events
A property sheet widget created with the CONTEXT_EVENTS keyword set returns the following event structure in response to a right mouse button click:
{WIDGET_CONTEXT, ID:0L, TOP:0L, HANDLER:0L, X:0L, Y:0L,
ROW:0L, COL:0L}
The first three fields are the standard fields found in every widget event. The X and Y fields give the device coordinates at which the event occurred, measured from the upper left corner of the property sheet widget. The ROW and COL fields return meaningful information for table widgets and values of zero (0) for other widgets.
Note: When working with property sheet context menu events, it is important to notice that the event structure does not have a TYPE field, so special code is needed for the property sheet event handler. Instead of keying off the TYPE field, use the structure's name. See Property Sheet Context Menu Example for sample code.
Example
Single Property Sheet Example
Enter the following program in the IDL Editor:
; ExSinglePropSheet
;
; Creates a base with a property sheet. Only the
; default properties are visible. The property sheet’s
; event handler sets values and reveals selection
; changes.
; Handler for selection or value modification events.
PRO PropertyEvent, event
IF (event.type EQ 0) THEN BEGIN ; Value changed.
; Get the value of the property identified by
; event.identifier.
value = WIDGET_INFO(event.ID, COMPONENT = event.component, $
PROPERTY_VALUE = event.identifier)
; Set the component’s property value.
event.component->SetPropertyByIdentifier, event.identifier, $
value
PRINT, 'Changed: ', event.identifier, ': ', value
ENDIF ELSE BEGIN ; Selection changed.
; Return information about single or multiple property
; selections.
vNumSelected = WIDGET_INFO(event.ID, /PROPERTYSHEET_NSELECTED)
vSelected = WIDGET_INFO(event.ID, /PROPERTYSHEET_SELECTED)
PRINT, 'Number properties selected: ' + STRING(vNumSelected)
PRINT, 'Selected properties: '
PRINT, vSelected
ENDELSE
END
; Handler for property sheet resize event.
PRO ExSinglePropSheet_event, event
prop = WIDGET_INFO(event.top, $
FIND_BY_UNAME = 'PropSheet')
WIDGET_CONTROL, prop, SCR_XSIZE = event.x, $
SCR_YSIZE = event.y
END
; Handler for top-level base kill event.
PRO CleanupEvent, baseID
WIDGET_CONTROL, baseID, GET_UVALUE = oComp
OBJ_DESTROY, oComp
END
PRO ExSinglePropSheet
; Create and initialize the component.
oComp = OBJ_NEW('IDLitVisAxis')
; Create a base and property sheet.
base = WIDGET_BASE(/TLB_SIZE_EVENT, $
TITLE = 'Single Property Sheet Example', $
KILL_NOTIFY = 'CleanupEvent')
prop = WIDGET_PROPERTYSHEET(base, VALUE = oComp, $
EVENT_PRO = 'PropertyEvent', UNAME = 'PropSheet', $
YSIZE=20, /MULTIPLE_PROPERTIES)
; Activate the widgets.
WIDGET_CONTROL, base, SET_UVALUE = oComp, /REALIZE
XMANAGER, 'ExSinglePropSheet', base, /NO_BLOCK
END
Save this program as exsinglepropsheet.pro
, then compile and run the program. A property sheet entitled Single Property Sheet Example is displayed:
For examples of the types of settings possible from the property sheet:
- Click the Show setting box, click the drop-down button, and select
False
from the list. - Click the Major tick length setting box, click its drop-down button, and move the slider to select a new value.
- Click the Text color setting box, click the drop-down button, and select a new color from the color selector.
Property Sheet Context Menu Example
The following simple example shows how to key event handling off of the event structure name instead of the event type. Attempting to use the CONTEXT_EVENTS keyword without this type of code will cause an error, because, unlike the WIDGET_PROPSHEET_CHANGE and WIDGET_PROPSHEET_SELECT event structures, the WIDGET_CONTEXT structure does not have a TYPE field.
; propsheet_context.pro
; For accessing property sheet widget context menus.
PRO prop_event, event
; Initiate event based on event structure name, not event type.
SWITCH TAG_NAMES( EVENT, /STRUCTURE_NAME ) OF
'WIDGET_PROPSHEET_CHANGE': $
; Placeholder for desired code.
BEGIN
BREAK
END
'WIDGET_PROPSHEET_SELECT': $
; Placeholder for desired code.
BEGIN
BREAK
END
'WIDGET_CONTEXT': $
BEGIN
contextBase = WIDGET_INFO( event.id, $
FIND_BY_UNAME = 'contextMenu' )
; Display the context menu at the x, y location
; of the right mouse click.
WIDGET_DISPLAYCONTEXTMENU, $
event.id, event.x, event.y, contextBase
BREAK
END
ENDSWITCH
END
PRO prop_cleanup, propSheet
; Clean up object references.
WIDGET_CONTROL, propSheet, GET_UVALUE = oAxis
OBJ_DESTROY, oAxis
END
PRO yes_event, event
print, 'Yes'
END
PRO no_event, event
print, 'No'
END
PRO propsheet_context
tlb = WIDGET_BASE( /ROW, XOFFSET = 100, YOFFSET = 100 )
; Create a property sheet with axis properties.
oAxis = OBJ_NEW( 'IDLitVisAxis' )
propSheet = WIDGET_PROPERTYSHEET( tlb, $
VALUE=oAxis, UVALUE=oAxis, KILL_NOTIFY='prop_cleanup', $
/CONTEXT_EVENTS, EVENT_PRO = 'prop_event' )
; Create a base for the context menu.
contextBase = WIDGET_BASE( propSheet, /CONTEXT_MENU, $
UNAME = 'contextMenu' )
; Add two buttons to the context menu's base.
cb1 = WIDGET_BUTTON( contextBase, VALUE = 'Yes', $
EVENT_PRO = 'yes_event' )
cb2 = WIDGET_BUTTON( contextBase, VALUE = 'No', $
EVENT_PRO = 'no_event' )
; Activate the widgets.
WIDGET_CONTROL, tlb, /REALIZE
XMANAGER, 'propsheet_context', tlb, /NO_BLOCK
END
Save and run the example. Left-clicking selects a property. Right-clicking brings up the context menu. Selecting one of the context menu items prints a related string to the Output Log window.
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 |