Previous Page | Next Page

SAS Component Language Dictionary

NUMFKEYS



Returns the number of function keys that are available for the device
Category: Keys

Syntax
Details
Example
See Also

Syntax

fkeynum=NUMFKEYS();

fkeynum

contains the number of function keys that are available for the device.

Type: Numeric


Details

You can use this function only in entries that have a window variable or text in the DISPLAY window.

You can use NUMFKEYS when you want to use SCL to return the number of function keys, then disable procedure-specific commands and SAS windowing commands and redefine the function keys while a window is open. When you redefine the function keys, you can limit the commands that can be used in an application window. (If you do this, you may want to restore the settings with SETFKEY before the application window closes.)


Example

Assign a custom PMENU. Then use NUMFKEYS to find out how many function keys a user's device has. Use SETFKEY first to disable them and then again to restore the settings when the window closes.

dcl char command(30);

INIT:
/* Assign the PMENU entry to the window.  */
   rc=pmenu('editdata.pmenu');
/* Turn the PMENU facility on.  */
   call execcmd('pmenu on');
/* Execute the MAIN section even if a user makes */
/* an error or issues an unknown command.  */
   control enter;
/* Determine the number of function keys */
/* on a user's keyboard.  */
   numkeys=numfkeys();
   do n=1 to numkeys;
      command{n}=getfkey (fkeyname(n));
  /* Disable function key assignments.  */
      call setfkey(fkeyname(n),'');
   end;
return;
MAIN:
    ...Statements to process custom commands...
return;
TERM:
/* Restore command assignments to function keys.*/
   do n=1 to numkeys;
      call setfkey(fkeyname(n),command{n});
   end;
/* Turn the PMENU facility off.  */
   call execcmd('pmenu off');
return;


See Also

FKEYNAME

GETFKEY

SETFKEY

Previous Page | Next Page | Top of Page