SAS Object-Oriented Programming Concepts |
Events alert applications when there is a change of state. Events occur when a user action takes place (such as a mouse click), when an attribute value is changed, or when a user-defined condition occurs. Event handlers then provide a response to the change.
Use the Class Editor to create events that are specific to an entire class. Use the Properties window to create events that are specific to a single object.
SAS/AF software supports system events, which can include user interface events (such as mouse clicks) as well as "attribute changed" events that occur when an attribute value is updated. For system events, the State metadata item is 'S'. In order for "attribute changed" events to be sent automatically, the component must have the SendEvent metadata item for the attribute set to 'Yes'. See Enabling Attribute Linking for details.
SAS/AF software also supports user-defined events, which can be registered to specific classes as needed and are inherited by subclasses.
Event Metadata |
Events are implemented and maintained with metadata. You can query a class (or an event within a class) to view the event metadata, and you can create your own metadata list to add or change an event. For example, to list the metadata for the click event, execute code similar to the following:
init: dcl num rc; dcl list metadata; dcl object obj; obj=loadclass('sashelp.classes.listbox_c.class'); rc=obj._getEvent('click',metadata); call putlist(metadata,'',3); return;
The following event metadata is returned:
(NAME='click' STATE='S' DESCRIPTION='Occurs on a click' CLASS=4415 EXECUTE='System' METHOD='' ENABLED='Yes' CLASS=4415 )
The event metadata list contains the following named items:
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.