Set Handler statement - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Enables or disables the automatic calling of system handler procedures, such as the SelChangedHandler procedure.

Restrictions

You cannot issue this statement through the MapBasic window.

Syntax

Set Handler handler_name { On | Off } 

handler_name is the name of a system handler procedure, such as SelChangedHandler procedure.

Description

Ordinarily, if you include a system handler procedure in your program, MapInfo Pro calls the handler procedure automatically, whenever a related system event occurs. For example, if your program contains a SelChangedHandler procedure, MapInfo Pro calls the procedure automatically, every time the Selection changes.

Use the Set Handler statement to disable the automatic calling of system handler procedures within your MapBasic program.

The Set Handler...Off statement does not have any effect on explicit procedure calls (using the Call statement).

Example

The following example shows how a Set Handler statement can help to avoid infinite loops.

Sub SelChangedHandler 
	Set Handler SelChangedHandler Off 

	' Issuing a Select statement here 
	' will not cause an infinite loop. 

	Set Handler SelChangedHandler On 
End Sub

See Also:

SelChangedHandler procedure, ToolHandler procedure