Command SET FUNCTION Foundation

This command is not supported in Xbase++ (an emulation is provided in the example).

Examples
Emulation of the command SET FUNCTION
// The command associates a function key with a character 
// string. For this command, the function keys from 1-40 
// are numbered and are specified by their Inkey() code. 
// In the example, the command is provided using a #command 
// directive and the user defined function __SETFUNCTION(). 

#command SET FUNCTION <nFKey> [TO] [<cString>] ; 
   => __SETFUNCTION( <nFKey>, #<cString> ) 


FUNCTION __SETFUNCTION( nFKey, cString ) 
   IF GetEnableEvents() 
      DO CASE 
         CASE nFKey <= 10 
            nFKey := nFKey + xbeK_F1 - 1 
         CASE nFKey <= 20 
            nFKey := nFKey + xbeK_CTRL_F1 - 11 
         CASE nFKey <= 30 
            nFKey := nFKey + xbeK_ALT_F1 - 21 
         CASE nFKey <= 40 
            nFKey := nFKey + xbeK_SH_F1 - 31 
      ENDCASE 

      IF Len( cString) == 0 
         RETURN SetAppEvent( nFKey, NIL) 
      ENDIF 
      RETURN SetAppEvent( nFKey, {|| _Keyboard( cString ) } ) 
   ELSE 
      nFKey := IIf( nFKey == 1, 28, 1 - nFKey ) 

      IF Len( cString) == 0 
        RETURN SetKey( nFKey, NIL) 
      ENDIF 
      RETURN SetKey( nFKey,{|| _Keyboard( cString)}) 
   ENDIF 
RETURN NIL 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.