Navigation:  Reference > Form Objects > Common Properties >

KeyTraps

Print this Topic Previous pageReturn to chapter overviewNext page

 

This property gives you a quick and easy way to set keyboard TRAPs that will execute only when that object has focus.  This property applies to objects that allow user entry only.  By including the trap here you are programming the equivalent of turning the trap on in a PRE event and turning it off in a POST.  Any trap that can be programmed through the use of the TRAP command can be added here, except for the RSRCH and RLCK traps.  The only limit to the number of traps you may include are the traps that are available.  Each trap you add must have a corresponding line label in the program that is currently executing.  So, when you include a trap here it's the same as specifying a GOSUB in your code.

 

There is a Property Editor attached to this property that will allow you to easily enter/edit the traps to be included.  However, you may enter the traps directly or at runtime.  The property is actual a single string (alpha field) with the traps and the corresponding line label separated by the pipe (|) symbol.  So, for example, if you want the F1 key to gosub to the line label GET_HELP and the F2 key to gosub to the line label DISP_RECS you could add the line directly as:

 

F1|GET_HELP|F2|DISP_RECS

 

If you have included this property in your object you may also want to include KeyTrapHint lines so that the user can tell easily which key traps are set.

 


Page url: http://www.cassoftware.com/tas/manual/keytraps.htm