ForegroundTaskSwitchHandler procedure - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
ft:locale
en-US
Product name
MapBasic
ft:title
MapInfo MapBasic Reference
First publish date
1985
ft:lastEdition
2023-09-12
ft:lastPublication
2023-09-12T16:32:32.686000

Purpose

A reserved procedure name, called automatically when MapInfo Pro receives the focus (becoming the active application) or loses the focus (another application becomes active).

Syntax

Declare Sub ForegroundTaskSwitchHandler 

Sub ForegroundTaskSwitchHandler 
	 statement_list 
End Sub 

statement_list is a list of statements.

Description

If the user runs an application containing a procedure named ForegroundTaskSwitchHandler, MapInfo Pro calls the procedure automatically whenever MapInfo Pro receives or loses the focus. Within the procedure, call the CommandInfo() function to determine whether MapInfo Pro received or lost the focus.

Example

Sub ForegroundTaskSwitchHandler 

	If CommandInfo(CMD_INFO_TASK_SWITCH) 
			= SWITCHING_INTO_MAPINFO Then 

	' ... then MapInfo just became active
	Else 
	' ... another app just became active
	End If 

End Sub 

See Also:

CommandInfo() function