Dialog Remove 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

Removes a custom dialog from the screen.

Syntax

Dialog Remove

Restrictions

This statement may only be issued from within a sub procedure that acts as a handler for a dialog box control. You cannot issue this statement from the MapBasic window.

Description

The Dialog Remove statement removes the dialog box created by the most recent Dialog statement. A dialog box disappears automatically after the user clicks on an OKButton control or a CancelButton control. Use the Dialog Remove statement (within a dialog box control's handler routine) to remove the dialog box before the user clicks OK or Cancel. This is useful, for example, if you have a dialog box with a ListBox control, and you want the dialog box to come down if the user double-clicks an item in the list

Note: Dialog Remove signals to remove the dialog box after the handler sub procedure returns. It does not remove the dialog box instantaneously

Example

The following procedure is part of the sample program NVIEWS.MB. It handles the ListBox control in the Named Views dialog box. When the user single-clicks a list item, this handler procedure enables various buttons on the dialog box. When the user double-clicks a list item, this handler uses a Dialog Remove statement to dismiss the dialog box.

Note: MapInfo Pro calls this handler procedure for click events and for double-click events.
Sub listbox_handler 
	Dim i As SmallInt 
	Alter Control 2 Enable 
	Alter Control 3 Enable 
	If CommandInfo(CMD_INFO_DLG_DBL) = TRUE Then 
		' 
		' ... then the user double-clicked. 
		' 
		i = ReadControlValue(1) 
		Dialog Remove 
		Call go_to_view(i) 
	End If 
End Sub 

See Also:

Alter Control statement, Dialog statement, Dialog Preserve statement, ReadControlValue() function