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

Reactivates a custom dialog box after the user clicked OK or Cancel.

Syntax

Dialog Preserve 

Restrictions

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

Description

The Dialog Preserve statement allows the user to resume using a custom dialog box (which was created through a Dialog statement) even after the user clicked the OKButton or CancelButton control.

The Dialog Preserve statement lets you "confirm" the user's OK or Cancel action. For example, if the user clicks Cancel, you may wish to display a dialog box asking a question such as "Do you want to lose your changes?" If the user chooses "No" on the confirmation dialog box, the application should reactivate the original dialog box. You can provide this functionality by issuing a Dialog Preserve statement from within the CancelButton control's handler procedure.

Example

The following procedure could be used as a handler for a CancelButton control.

Sub confirm_cancel 
	If Ask("Do you really want to lose your changes?", 
		"Yes", "No") = FALSE Then 
		Dialog Preserve 
	End If 
End Sub 

See Also:

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