Document revision date: 30 March 2001
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

DEC Text Processing Utility Reference Manual


Previous Contents Index

The following example creates a small "scratch pad" window and maps it to a scratch buffer called junk1.txt. The procedure defines a key map list that consists of a user-defined key map redefining M1DRAG plus the standard EVE mouse key map. By setting the scratch window's key map list to be user_scratch_list, the procedure invokes sample_m1_drag when you drag the mouse in the scratch window. By not declaring the variables as local variables, they are global variables that exists after the procedure executes.
#2

PROCEDURE user_scratch_window 
 
scratch_window := CREATE_WINDOW (20, 3, ON); 
scratch_buffer := CREATE_BUFFER ("test", "junk.txt"); 
scratch_map := CREATE_KEY_MAP ("user_scratch_map"); 
DEFINE_KEY (eve$$kt_return + "sample_M1_DRAG", M1DRAG, "mouse_button_1", 
            "user_scratch_map"); 
scratch_list := CREATE_KEY_MAP_LIST ("user_scratch_list", "user_scratch_map", 
                                      eve$x_mouse_keys); 
SET (KEY_MAP_LIST, "user_scratch_list", scratch_window); 
MAP (scratch_window, scratch_buffer); 
 
ENDPROCEDURE; 
 
      


SET (KEYSTROKE_RECOVERY)


Format

SET (KEYSTROKE_RECOVERY {ON |OFF |1 |0})


Parameters

KEYSTROKE_RECOVERY

A keyword that directs DECTPU to enable or disable keystroke recovery, depending on whether the /RECOVER or /NORECOVER qualifier was specified on the command line.

ON, 1

A keyword that enables keystroke recovery. (This has the same effect as specifying the /RECOVER qualifier.)

OFF, 0

A keyword that disables keystroke recovery. (This has the same effect as specifying the /NORECOVER qualifier.)

Description

The SET (KEYSTROKE_RECOVERY) procedure turns keystroke journal recovery on or off. If you specify the /RECOVER qualifier when you invoke DECTPU, DECTPU checks whether the application calls the JOURNAL_OPEN built-in procedure to open a keystroke journal file. If the application does not call the JOURNAL_OPEN built-in, by default DECTPU signals an error when the application starts accepting keyboard input.

In some circumstances, you may want your application to accept the /RECOVER qualifier without error, even though the application does not call the JOURNAL_OPEN built-in. For example, if your application uses only buffer-change journaling, you can use the /RECOVER qualifier when DECTPU is invoked, but the JOURNAL_OPEN built-in is not used.

Use SET (KEYSTROKE_RECOVERY, OFF) to disable the error caused by the lack of a call to JOURNAL-OPEN and concurrently to prevent DECTPU from performing keystroke recovery (even if the /RECOVER qualifier is specified and you use JOURNAL_OPEN). Conversely, use SET (KEYSTROKE_RECOVERY, ON) to direct DECTPU to perform keystroke recovery (even if the /NORECOVER qualifier is specified and you use JOURNAL_OPEN).

SET (KEYSTROKE_RECOVERY) signals an error if the application code or the user calls the built-in after DECTPU has started accepting keyboard input.

To determine whether a recovery using a keystroke journal file is currently in progress, use GET_INFO (SYSTEM, "recover"). This GET_INFO call returns FALSE (0) if no keystroke recovery is currently in progress, and returns TRUE (1) if a keystroke recovery is currently in progress. SET (KEYSTROKE_RECOVERY) can determine the value returned by GET_INFO (SYSTEM, "recover") but cannot affect the value returned by GET_INFO (COMMAND_LINE, "recover"). GET_INFO (COMMAND_LINE, "recover") returns a value that indicates whether you specified the /RECOVER qualifier when you invoked DECTPU.

Signaled Errors

TPU$_JNLNOTOPEN ERROR No keystroke journal file is open from which to recover.
TPU$_RECJNLOPEN ERROR A keystroke journal file is already open.
TPU$_TOOFEW ERROR You specified too few parameters.
TPU$_TOOMANY ERROR You specified too many parameters.
TPU$_INVPARAM ERROR You specified a parameter with the wrong data type.
TPU$_BADKEY ERROR You specified an invalid keyword.

Example

The following example directs DECTPU to do keystroke journal recovery even if the /NORECOVER qualifier was specified on the command line that invoked DECTPU:

SET (KEYSTROKE_RECOVERY, ON) 
 
      


SET (LEFT_MARGIN)


Format

SET (LEFT_MARGIN, buffer, integer)


Parameters

LEFT_MARGIN

The left margin of a buffer.

buffer

The buffer in which the left margin is being set.

integer

The column at which the left margin is set.

Description

With the SET (LEFT_MARGIN) procedure, you can change only the left margin of a buffer.

Newly created buffers receive a left margin of 1 (that is, the margin is set in column 1) if a template buffer is not specified in the call to the CREATE_BUFFER built-in procedure. If a template buffer is used, that buffer sets the left margin for all newly created buffers.

Use SET (LEFT_MARGIN) to override the default left margin.

The buffer margin settings are independent of the terminal width or window width settings. The FILL built-in procedure uses these margin settings when it fills the text of a buffer.

When DECTPU creates a new line, the line gets its left margin value from the left margin of the current buffer setting. However, changing the left margin setting for the buffer does not change the left margin for any existing lines.

The value of the left margin must be at least 1 and less than the right margin value.

If you want to use the margin settings of an existing buffer in a user-written procedure, GET_INFO (buffer, "left_margin") and GET_INFO (buffer, "right_margin") return the values of the margin settings in the specified buffer.

Signaled Errors

TPU$_TOOFEW ERROR The SET (LEFT_MARGIN) built-in requires three parameters.
TPU$_TOOMANY ERROR You specified more than three parameters.
TPU$_INVPARAM ERROR One or more of the specified parameters have the wrong type.
TPU$_BADMARGINS WARNING The left margin setting must be less than the right; both must be greater than zero.

Examples

The following example causes the left margin of the buffer represented by the variable my_buffer to be changed. The left margin of the buffer is set to 1. The right margin is unchanged.
#1

SET (LEFT_MARGIN, my_buffer, 1) 
      

The following example causes the left margin of the current buffer to be changed to 10; the right margin is unchanged:

#2

SET (LEFT_MARGIN, CURRENT_BUFFER, 10) 
 
      


SET (LEFT_MARGIN_ACTION)


Format

SET (LEFT_MARGIN_ACTION, buffer1 [[{, buffer2 |, learn_sequence |, program |, range |, string}]])


Parameters

LEFT_MARGIN_ACTION

Refers to the action taken when you press a self-inserting key while the cursor is to the left of a line's left margin. A self-inserting key is one that is associated with a printable character.

buffer1

The buffer in which the left margin action routine is being set.

buffer2

A buffer that contains the DECTPU statements to be executed when you press a self-inserting key while the cursor is to the left of a buffer's left margin.

learn_sequence

A learn sequence that is to be replayed when you press a self-inserting key while the cursor is to the left of a buffer's left margin.

program

A program that is to be executed when you press a self-inserting key while the cursor is to the left of a buffer's left margin.

range

A range that contains DECTPU statements that are to be executed when you press a self-inserting key while the cursor is to the left of a buffer's left margin.

string

A string that contains DECTPU statements that are to be executed when you press a self-inserting key while the cursor is to the left of a buffer's left margin.

Description

With the SET (LEFT_MARGIN_ACTION) procedure, you can specify an action to be taken when you attempt to insert text to the left of the left margin of a line. If the third parameter is not specified, the left margin action routine is deleted. If no left margin action routine has been specified, the text is inserted at the current position before any necessary padding spaces, and the left margin of the line becomes the current position.

Newly created buffers do not receive a left margin action routine if a template buffer is not specified on the call to the CREATE_BUFFER built-in procedure. If a template buffer is specified, the left margin action routine of the template buffer is used.

The left margin action routine affects only text entered from the keyboard or a learn sequence. Using the COPY_TEXT or MOVE_TEXT built-in procedure to insert text into a buffer to the left of the left margin does not trigger the left margin action routine.

Signaled Errors

TPU$_TOOFEW ERROR The SET (LEFT_MARGIN_ACTION) built-in requires at least two parameters.
TPU$_TOOMANY ERROR You specified more than three parameters.
TPU$_INVPARAM ERROR One or more of the specified parameters have the wrong type.
TPU$_COMPILEFAIL ERROR Compilation aborted because of syntax errors.

Examples

The following example causes the procedure PUSH_TO_LEFT_MARGIN to be executed when you attempt to type a character to the left of the left margin of the current line. A typical left margin action routine moves the editing point to the left margin and inserts an appropriate number of spaces starting at the left margin.
#1

SET (LEFT_MARGIN_ACTION, CURRENT_BUFFER, "push_to_left_margin") 
      

The following example deletes any left margin action routine that may be defined for the current buffer. When there is no user-defined left margin action routine, if you type a character to the left of the current line's left margin, the text is inserted with spaces padding the text to the old left margin. The leftmost character on the line establishes the line's new left margin.

#2

SET (LEFT_MARGIN_ACTION, CURRENT_BUFFER) 
 
      


SET (LINE_NUMBER)


Format

SET (LINE_NUMBER, {ON |OFF |1 |0})


Parameters

LINE_NUMBER

Refers to the DECTPU display of the procedure and line number at which an error occurred.

ON, 1

Turns on display of the line number and procedure at which an error occurred.

OFF, 0

Turns off display of the line number and procedure at which an error occurred.

Description

The SET (LINE_NUMBER) procedure is related to the SET (TRACEBACK) procedure. SET (TRACEBACK, ON) turns on both traceback and line numbers. SET (LINE_NUMBER, OFF) turns off both traceback and line numbers. You can also set traceback off and line numbers on. Line numbers are useful for programmers debugging DECTPU programs, but they do not have much meaning to users who do not have the source code available to them.

After a compilation, the line numbers displayed for procedures are relative to the beginning of the procedure. For DECTPU statements compiled outside a procedure, the line numbers displayed are relative to the beginning of the buffer, range, or string being compiled. If there are no procedure declarations before the executable statements, line numbering starts at the beginning of the buffer or range that is being compiled. For strings, the line number is always 1.

You can change line numbers when you use the SAVE built-in to write a section file. If you specify the parameter NO_PROCEDURE_NAMES, the line numbers displayed are relative to the beginning of the buffer or range that was compiled, not relative to the beginning of a procedure.

The default setting for LINE_NUMBER depends on whether a section file was loaded by DECTPU. If a section file was loaded, the default is OFF. If a section file was not loaded, the default is ON.

Signaled Errors

TPU$_TOOFEW ERROR The SET (LINE_NUMBER) built-in requires two parameters.
TPU$_TOOMANY ERROR You specified more than two parameters.
TPU$_INVPARAM ERROR One or more of the specified parameters have the wrong type.
TPU$_BADKEY ERROR Only the keywords ON and OFF are allowed.

Example

The following example displays the line number at which the error occurred:

PROCEDURE line_number_example 
    SET (LINE_NUMBER, ON); 
    SET (LINE_NUMBER, BELL); 
ENDPROCEDURE; 
 
      

Executing this procedure displays the following in the message buffer:


BELL is an invalid keyword 
At line 3 


SET (MAPPED_WHEN_MANAGED)


Format

SET (MAPPED_WHEN_MANAGED,widget, {ON |OFF |1 |0})


Parameters

MAPPED_WHEN_MANAGED

A keyword that indicates that SET is being used to control whether the specified widget should become visible when it is managed.

widget

The widget whose mapped status you want to set.

ON, 1

A keyword that directs DECTPU to make the specified widget visible when it is managed. This is the default value.

OFF, 0

A keyword that directs DECTPU not to make the specified widget visible when it is managed.

Description

The SET (MAPPED_WHEN_MANAGED) procedure controls whether a widget is mapped to the screen when it is managed. SET (MAPPED_WHEN_MANAGED) does not return the previous state of the modified widget. For more information on managing widgets, see the VMS DECwindows Guide to Application Programming and the VMS DECwindows Toolkit Routines Reference Manual.

Signaled Errors

TPU$_INVPARAM ERROR One of the parameters was specified with data of the wrong type.
TPU$_NORETURNVALUE ERROR Built-in does not return a value.
TPU$_REQUIRESDECW ERROR Requires the DECTPU DECwindows screen updater.
TPU$_TOOFEW ERROR You specified too few parameters.
TPU$_TOOMANY ERROR You specified too many parameters.

Example

The following example directs DECTPU to make the widget contained in example_widget invisible when the widget is managed:

SET (MAPPED_WHEN_MANAGED, example_widget, OFF); 
 
      


SET (MARGINS)


Format

SET (MARGINS, buffer, integer1, integer2)


Parameters

MARGINS

A keyword that indicates that SET is to determine the left and right margins of a buffer. The default left margin is 1 and the default right margin is 80.

buffer

The buffer in which the margins are being set.

integer1

The column at which the left margin is set.

integer2

The column at which the right margin is set.

Description

With the SET (MARGINS) procedure, you can change the left and right margins of a buffer. The default margins for a buffer are set to 1 for the left margin and 80 for the right margin when you use the CREATE_BUFFER built-in. The FILL built-in procedure uses these margin settings when it fills the text of a buffer.

This built-in procedure controls the buffer margin settings even if the terminal width or window width is set to something else.

The value of the left margin must be at least 1 and less than the right margin value. The value of the right margin must be less than the maximum record size for the buffer. You can use the GET_INFO (buffer, "record_size") built-in procedure to find out the maximum record size of a buffer.

If you want to use the margin settings of an existing buffer in a user-written procedure, the statements GET_INFO (buffer, "left_margin") and GET_INFO (buffer, "right_margin") return the values of the margin settings.

Signaled Errors

TPU$_TOOFEW ERROR The SET (MARGINS) built-in requires four parameters.
TPU$_TOOMANY ERROR You specified more than four parameters.
TPU$_INVPARAM ERROR One or more of the specified parameters have the wrong type.
TPU$_BADMARGINS WARNING Left margin must be smaller than right; both must be greater than zero.

Examples

The following example causes the margins of the buffer represented by the variable my_buffer to be changed. The left margin of the buffer is set to 1 and the right margin is set to 132.
#1

SET (MARGINS, my_buffer, 1, 132) 
 
      

The following example causes the margins of the current buffer to be changed to left margin 10 and right margin 70:

#2

SET (MARGINS, CURRENT_BUFFER, 10, 70) 
 
      


SET (MAX_LINES)


Format

SET (MAX_LINES, buffer, integer)


Parameters

MAX_LINES

The maximum number of lines a buffer can contain.

buffer

The buffer for which you are setting the maximum number of lines.

integer

The maximum number of lines for the buffer. The valid values are 0, 2, or an integer greater than 2. The maximum value depends on the memory capacity of your system. The default maximum number of lines is 0 (in other words, this feature is turned off).

Description

With the SET (MAX_LINES) procedure, if you exceed the maximum number of lines for a buffer, DECTPU deletes lines from the beginning of the buffer to make room for any lines that exceed the maximum.

SET (MAX_LINES) does not consider the end-of-buffer text to be a record. For example, if you set the maximum number of lines to be 1000, the buffer can contain 1000 records plus the end-of-buffer text.

If you specify a value of 0 for integer, this feature is turned off and DECTPU does not check for the maximum number of lines.

Signaled Errors

TPU$_MINVALUE WARNING Argument less than minimum allowed.
TPU$_MAXVALUE WARNING Argument greater than maximum allowed.
TPU$_INVPARAM ERROR One or more of the specified parameters have the wrong type.
TPU$_TOOMANY ERROR SET (MAX_LINES) accepts only three parameters.
TPU$_TOOFEW ERROR SET (MAX_LINES) requires three parameters.

Example

The following example causes the maximum number of lines for the message buffer to be 20. Only the most recent lines of messages are kept.

SET (MAX_LINES, message_buffer, 20) 
 
      


SET (MENU_POSITION)


Format

{array1|NONE}:= SET (MENU_POSITION, mouse_down_button, {array2 |NONE |widget})


Parameters

MENU_POSITION

A keyword that indicates that the SET built-in procedure is being used to set the menu position of a pop-up widget or widgets.

mouse_down_button

A keyword (M1DOWN, M2DOWN, M3DOWN, M4DOWN, or M5DOWN) that indicates the mouse button associated with the pop-up menus.

array2

An integer-indexed array of pop-up menu widgets to be set for automatic menu positioning.

NONE

A keyword that requests that DECTPU stop automatic positioning of pop-up menu widgets for the specified mouse button.

widget

The pop-up menu widget to be set for automatic menu positioning.

Return Values


array1

An integer-indexed array of all pop-up menu widgets that were set for automatic positioning for the specified mouse button before this built-in call.

NONE

A keyword that indicates that no pop-up menu widgets were set for the specified mouse button before this built-in call.

Description

The SET (MENU_POSITION) procedure sets menu positioning for one or more pop-up widgets. DECwindows systems do not require pop-up menus to position the last menu item chosen under the mouse pointer. However, this built-in is required to position the pop-up menu below and to the right of the pointer. If you do not use this built-in, DECTPU positions the pop-up widget at the upper left corner of the display.

Signaled Errors

TPU$_INVPARAM ERROR One of the parameters was specified with data of the wrong type.
TPU$_REQUIRESDECW ERROR Requires the DECTPU DECwindows screen updater.
TPU$_TOOFEW ERROR You specified too few parameters.
TPU$_TOOMANY ERROR You specified too many parameters.
TPU$_BADKEY WARNING You specified an invalid keyword.
TPU$_NEEDTOASSIGN ERROR Built-in must return a value.
TPU$_EXTRANEOUSARGS ERROR The array of widgets parameter had a nonwidget element.
TPU$_REQARGSMISSING ERROR The array of widgets parameter was empty.

SET (MESSAGE_ACTION_LEVEL)


Format

SET (MESSAGE_ACTION_LEVEL, {integer|keyword})


Parameters

MESSAGE_ACTION_LEVEL

A keyword that indicates that SET is to determine the severity level at which DECTPU sounds the terminal bell or highlights a message.

integer

A value between 0 and 3 that specifies the severity level at which DECTPU is to take the action you designate. The default value is 2. The severity levels and corresponding values, in ascending order of severity, are as follows:
1 Success
3 Informational
0 Warning
2 Error


Previous Next Contents Index

  [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]  
  privacy and legal statement  
6020PRO_029.HTML