Chapter Contents

Previous

Next
EVENT

EVENT



Reports whether a user has pressed a function key, ENTER key, or mouse button

Category: Keys


Syntax
Details
Example
See Also

Syntax

rc=EVENT();

rc
contains the return code for the operation:
1 A function key, ENTER key, or mouse button was pressed since the last event call.
0 A function key, ENTER key, or mouse button was not pressed since the last event call.

Type: Numeric


Details

A mouse click registers as an event only when it occurs in a FRAME entry control that responds to mouse events (for example, pushbuttons, check boxes, radio boxes, icons, and blocks).

EVENT is useful when you want your program to continue a task while it waits for user input. For example, your application can read data from an external source and display the results. When a user presses an appropriate key, you can stop processing and handle the request.

Operating Environment Information:   OS/390 and CMS

EVENT does not work under OS/390 or CMS, nor on ASCII DRIVER machines. On these systems you should use the attention handler exit that is provided in SCL. Refer to the discussion of the BREAK option for CONTROL.  [cautionend]


Example

Display the date and time until a user presses either ENTER or one of the function keys. The variable DATETIME is a numeric window variable with the format DATETIME17.2. When a user presses ENTER or a function key, the program exits the loop and returns control to the application. In this example, when a user issues a RUN command, the loop resumes.

INIT:
   control allcmds;
return;
MAIN:
   if _status_ in ('C','E') then return;
   if (word(1,'U')='RUN') then
      do while(event()=0);
         datetime=datetime();
         refresh;
      end;
return;

TERM:
return;

See Also

CONTROL


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.