SET FUNCTION
Topic group Related topics Example
Assigns a string to a function key or to a combination of the Ctrl (control) key or the Shift key and a function key.
Syntax
SET FUNCTION <key> TO <expC>
<key>
A function key number, function key name, or character expression of a function key name—for example, 3, F3, or "F3". Specify a character expression for <key> to assign a key combination using the Ctrl or Shift key with a function key. Type "CTRL+" or "SHIFT+" and then a function key name—for example, "shift+F5" or "Ctrl+f3". The function key names are not case-sensitive and you may use a hyphen in place of the plus sign. You can't combine Ctrl and Shift, such as "Ctrl+Shift+F3".
<expC>
Any character string, often the text of a command. Use a semicolon (;) to represent the Enter key. Placing a semicolon at the end of a command has the effect of executing that command when you press the function key in the Command window. You can execute more than one command by separating each command in the list with a semicolon.
Default
The following function key settings are in effect when dBASE Plus starts:
Key |
Command |
Key |
Command |
F1 |
HELP; |
F7 |
DISPLAY MEMORY; |
F3 |
LIST; |
F8 |
DISPLAY; |
F4 |
DIR; |
F9 |
APPEND; |
F5 |
DISPLAY STRUCTURE; |
F10 |
Activates the menu |
F6 |
DISPLAY STATUS; |
|
|
Description
Use SET FUNCTION to simulate typing a string with a single keystroke. These strings are usually commands to be executed in the Command window, or common strings used in data entry.
Note
F2 is reserved for toggling between views while in the Browse window. You can program it, but it will not be recognized when in the Browse window. You cannot program F10, or any combination using F11 or F12. You cannot program keys that are used as standard Windows functions, such as Ctrl-F4.
When you press the programmed function key or key combination, the assigned string appears at the cursor. Strings for the Command window usually end in a semicolon, which represents the Enter key. The simulated Enter key causes the command to be executed immediately.
While SET FUNCTION is specifically intended to simulate typing a string, you can use the ON KEY command to program a function key or any other key to execute any command. For example, these two commands (executed separately, not consecutively):
set function f7 to "display memory;"
on key label f7 display memory
would both cause the F7 key to execute the DISPLAY MEMORY command if the key was pressed on a blank line in the Command window. But suppose the line in the Command window contained the word "field" and the cursor was at the beginning of that line. Then with SET FUNCTION F7, pressing the function key would cause the string "display memory" to be typed into the line, resulting in "display memoryfield", and then the Enter key would be simulated, causing dBASE Plus to attempt to display a field named "memoryfield" in the current workarea. With ON KEY LABEL F7, the DISPLAY MEMORY command would be executed with nothing being typed into the Command window.
If the cursor was in an entryfield for a city in a form, then with SET FUNCTION F7, you would get the city of "display memory" and the cursor would move to the next control if SET CUAENTER was OFF. Again, with ON KEY LABEL F7, the DISPLAY MEMORY command would be executed without affecting the data entry.
To see the list of strings currently assigned to function keys, use DISPLAY STATUS.