Difference between revisions of "SET KEY TO"

From Recital Documentation Wiki
Jump to: navigation, search
 
(Products)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=SET KEY...TO=
 
 
 
==Class==
 
Keyboard Events
 
 
  
 
==Purpose==
 
==Purpose==
Define hot keys
+
Map a menu option to a control or function key in a form
  
  
 
==Syntax==
 
==Syntax==
SET KEY <expN> TO <procedure name>
+
SET KEY TO <expN>
  
  
 
==See Also==
 
==See Also==
SET KEY, INKEY(), READKEY(), SET PCKEYS, PROCNAME(), PROCLINE(), READVAR(), PRINTSCREEN()
+
[[@...GET]], [[@...MENU]], [[@...SAY]], [[APPEND]], [[CHANGE]], [[CREATE SCREEN]], [[CTRL()]], [[EDIT]], [[FMT()]], [[Function Keys]], [[INSERT]], [[KEYBOARD]], [[MODIFY SCREEN]], [[QUERY]], [[READ]], [[SET FORMAT]], [[SET KEY]]
  
  
 
==Description==
 
==Description==
The SET KEY...TO command enables a user, running an application, to press a key which will cause execution of the specified procedure whenever the program is waiting for keyboard input.  All keys, excluding a through z and 0 through 9, may be used.
+
The SET KEY TO <expN> command is used in custom screen formats to map a menu option to a function or control key.
 +
 
 +
A screen format file, which is activated with the SET FORMAT TO <.fmt filename> command, can contain a form definition using @...SAY...GET commands, and can also contain a menu definition using @...MENU commands.  When the form is activated by one of the full screen forms based commands APPEND, CHANGE, EDIT, INSERT, QUERY or READ, the form is displayed on the screen and data input mode is enteredIf the [MENUBAR] key is pressed, then any @...MENU commands which have been defined in the screen format file are activated.  You can then specify the SET KEY TO <expN> command as the command on the @...MENU command.
  
NOTE: It is important to distinguish this command from the previous command (SET KEY TO <expN>) which has a different purpose.
+
If you issue the SET KEY TO -1 command, activated from a menu selection, the menu will be exited.  The CTRL() function is often used with the SET KEY TO command.  The Screen Painter, initiated with the CREATE SCREEN command, allows menu items to be built into forms.
  
On completion of the procedure, execution of the application continues from the point at which it left.  Any valid Recital command can be used in the procedure.  The <expN> is the INKEY() value of the key and <procedure name> is the procedure to be executed when the key is pressedThe executed procedure specified in the SET KEY...TO command is passed three parameters with the values of PROCNAME(), PROCLINE(), and READVAR() respectively.
+
NOTE: It is important to distinguish this command from the [[SET KEY|SET KEY <expN> TO <procedure name>]] command, which has a different purposeAn alternative to the SET KEY command is to use the KEYBOARD command.
  
  
 
==Example==
 
==Example==
<pre>
+
<code lang="recital">
procedure showlist
+
// Dataentry.fmt
save screen
+
@0,0 say  "Next"
aliasnam = select()
+
@0,0 menu "Next";
use shows in workarea()
+
  command "set key to ctrl(’n’)"
display all
+
@0,5 say  "Prev"
select &aliasnam
+
@0,5 menu "Prev";
restore screen
+
  command "set key to ctrl(’r’)"
 +
// The form would now be defined
 
return
 
return
  
set key 28 to showlist
+
use patrons index events, dates, names
accept "Enter Show Name (F1 for Help)" to event</pre>
+
set format to dataentry
 +
change</code>
  
  
 
==Products==
 
==Products==
Recital Mirage Server, Recital Terminal Developer
+
Recital  
 +
[[Category:Documentation]]
 +
[[Category:Commands]]
 +
[[Category:Set_Commands|KEY TO]]
 +
[[Category:Keyboard Events]]
 +
[[Category:Keyboard Events Set Commands]]

Latest revision as of 16:12, 23 November 2009

Purpose

Map a menu option to a control or function key in a form


Syntax

SET KEY TO <expN>


See Also

@...GET, @...MENU, @...SAY, APPEND, CHANGE, CREATE SCREEN, CTRL(), EDIT, FMT(), Function Keys, INSERT, KEYBOARD, MODIFY SCREEN, QUERY, READ, SET FORMAT, SET KEY


Description

The SET KEY TO <expN> command is used in custom screen formats to map a menu option to a function or control key.

A screen format file, which is activated with the SET FORMAT TO <.fmt filename> command, can contain a form definition using @...SAY...GET commands, and can also contain a menu definition using @...MENU commands. When the form is activated by one of the full screen forms based commands APPEND, CHANGE, EDIT, INSERT, QUERY or READ, the form is displayed on the screen and data input mode is entered. If the [MENUBAR] key is pressed, then any @...MENU commands which have been defined in the screen format file are activated. You can then specify the SET KEY TO <expN> command as the command on the @...MENU command.

If you issue the SET KEY TO -1 command, activated from a menu selection, the menu will be exited. The CTRL() function is often used with the SET KEY TO command. The Screen Painter, initiated with the CREATE SCREEN command, allows menu items to be built into forms.

NOTE: It is important to distinguish this command from the SET KEY <expN> TO <procedure name> command, which has a different purpose. An alternative to the SET KEY command is to use the KEYBOARD command.


Example

// Dataentry.fmt
@0,0 say  "Next"
@0,0 menu "Next";
  command "set key to ctrl(’n’)"
@0,5 say  "Prev"
@0,5 menu "Prev";
  command "set key to ctrl(’r’)"
// The form would now be defined
return
 
use patrons index events, dates, names
set format to dataentry
change


Products

Recital