Directives 

DEFCTL

Define/Redefine CTL Values

Formats

1.

Define/Delete CTL Values:

DEFCTL [WINDOW] eom$={ctl_val | *}

2.

Redefine CTL Values:

DEFCTL [WINDOW | WINDOW+] ctl_val={alternate | *}

Where:

*

An asterisk deletes the previously defined CTL value (e.g. defctl eom$=*).

alternate

Alternate integer to set as the CTL value. Numeric expression.

ctl_val

CTL variable's value. Numeric expression, integer.

eom$

EOM (End-of-Message) character sequence. Generally provided as a Hex string expression (e.g. $0D$ for the Enter key).

WINDOW[+]

Optional keyword indicating:

WINDOW

The setting is for the current window only.

WINDOW+

The setting is for the current window but also cascades to apply to lower level windows.

Description

Use the DEFCTL directive to define additional CTL values; however, the replacement only occurs if the original CTL code is rejected.

Use the DEFCTL WINDOW format to maintain the definition for the current window only. If WINDOW+ is used, the definition will cascade to lower level windows.

Format 1

Define/Delete CTL Values

DEFCTL [WINDOW] eom$={ctl-val | *

Use DEFCTL to define an additional CTL value to be returned for a given EOM (End-of-Message) value or to delete one. The EOM string is the sequence of characters received from the terminal to end the current input. The first character of the string must be a non-printable character between $00$ and $1F$, or $7F$:

0010 defctl $09$=6 ! Set TAB key to return CTL=6
0020 defctl $1B38$=7 ! Set HOME <esc>H to CTL=7
0030 defctl $09$=* ! Delete control value setting defined @line 0010

The normal setting for the TAB key is to return CTL = -1015.

0010 defctl $09$ = -1015

Positive CTL values will be returned to the program. Negative CTL values have special significance to PxPlus.

See Also

Negative CTL Definitions
Function and Control Keys
CTL Control Code: Key to End Input
EOM End-of-Message Character String

Format 2

Redefine CTL Value

DEFCTL [WINDOW | WINDOW+] invalid_ctl= {alternate | *

Use this format of the DEFCTL directive to define alternate CTL values to be applied whenever the specified CTL value is received and it would normally be rejected (e.g. a Page Up during a simple INPUT directive or Backspace when at the start of input).

Example:

If you wanted to map the UP-ARROW (CTL=-1011) to return a CTL=3 whenever it was pressed and there was no valid location in the input to go to:

defctl -1011=3 ! Return CTL 3 on up arrow

See Also

CTL( ) Return CTL Definition
CTL Control Code: Key to End Input

Creating a Hot Key

PxPlus allows you to create a hot key that will CALL a program if it is pressed while the system is awaiting input.

To create such a hot key, define the control sequence that is generated by the key as a negative CTL value in the range -10 through -999. Then, create and save your hot key program using the naming convention $CTL-num where num is the CTL value. Remember in your hot key program not to disturb the environment (i.e. do not close any files that are already open, but close any files you open in this program and remove any windows you create).

Example:

The keystroke Ctrl-A returns $01$, which is defined in MY_START_UP program as a hot key:

defctl $01$=-500

PxPlus will call $CTL-500 whenever anyone hits the hot key Ctrl-A throughout the current session.

During Conversions

When you convert BBx-style programs to PxPlus, it is sometimes necessary to have function and edit keys return single-character values.

To do this, set both the 'EL' and 'FL' mnemonics and then use DEFCTL to redefine the mapped values and allow standard PxPlus functions to continue to operate.

Example

This example redefines function keys F5 through F8 to return a single Hex character ($F5$ through $F8$ respectively). It also maps some of the input edit keys to single character codes.

     defctl $000074$=5 ! Reset F5 TO CTL=5
! ^ 100 - Map F5-F8 to return $F5$ through $F8$
     print 'FL',"2"+chr(4)+chr(1)+$F5$, ! F5 = $F5$
     print 'FL',"2"+chr(5)+chr(1)+$F6$, ! F6 = $F6$
     print 'FL',"2"+chr(6)+chr(1)+$F7$, ! F7 = $F7$
     print 'FL',"2"+chr(7)+chr(1)+$F8$, ! F8 = $F8$
     defctl $F5$=5
     defctl $F6$=6
     defctl $F7$=7
     defctl $F8$=8
! ^ 100 - Change Edit keys to single character
     print 'EL',"2"+chr(4)+chr(1)+$01$, ! Home = $01$
     print 'EL',"2"+chr(5)+chr(1)+$1A$, ! End = $1A$
     print 'EL',"2"+chr(6)+chr(1)+$15$, ! PGUP = $15$
     print 'EL',"2"+chr(7)+chr(1)+$06$, ! PGDN = $06$
     print 'EL',"2"+chr(8)+chr(1)+$14$, ! Insert = $14$
     print 'EL',"2"+chr(9)+chr(1)+$18$, ! Delete = $18$
     defctl $01$=-1010 ! Home
     defctl $1A$=-1018 ! End
     defctl $15$=-1014 ! PGUP
     defctl $06$=-1013 ! PGDN
     defctl $14$=-1009 ! Insert
     defctl $18$=-1007 ! Delete

 

 

 

BBx is a registered trademark of BASIS International Ltd.