Control Button / OKButton / CancelButton clause - 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

Part of a Dialog statement; adds a push-button control to a dialog box.

Syntax

Control { Button | OKButton | CancelButton } 
	[ Position x, y ] [ Width w ] [ Height h ] 
	[ ID control_ID ] 
	[ Calling handler ] 
	[ Title title_string ] 
	[ Disable ] [ Hide ] 

x, y specifies the button's position in dialog box units.

w specifies the width of the button in dialog box units; default width is 40.

h specifies the height of the button in dialog box units; default height is 18.

control_ID is an integer; cannot be the same as the ID of another control in the dialog box.

handler is the name of a procedure to call if the user clicks on the button.

title_string is a text string to appear on the button.

Description

If a Dialog statement includes a Control Button clause, the dialog box includes a push-button control. If the OKButton keyword appears in place of the Button keyword, the control is a special type of button; the user chooses an OKButton control to "choose OK" and dismiss the dialog box. Similarly, the user chooses a CancelButton control to "choose Cancel" and dismiss the dialog box. Each dialog box should have no more than one OKButton control, and have no more than one CancelButton control. Disable makes the control disabled (grayed out) initially. Hide makes the control hidden initially.

Use the Alter Control statement to change a control's status (e.g., whether the control is enabled or hidden).

Example

Control Button 
	Title "&Reset" 
	Calling reset_sub 
	Position 10, 190 

See Also:

Alter Control statement, Dialog statement