Running a Script with a Function Key

Description

You can use the OnKey event to trap any keystroke and run a script. For example, the following code on the OnKey event will trap the F2 key and run a user defined function.

 Examples

select
    case a_user.key.value = "{F2}" .and. a_user.key.event = "down"
        a_user.key.handled = .T.
        ' if the script or function was already attached to the OnPush event of a button
        parentform:button1.push()
        ' run the function directly
        result = my_function(my_arguments)
    case ...
end select

See Also