Purpose
Disables, hides, or assigns new values to controls in MapInfo Pro's standard dialog boxes.
Restrictions
Syntax 1 (assigning non-default settings)
Alter MapInfoDialog dialog_ID
Control control_ID
{ Disable | Hide | Value new_value } [ , { Disable... } ]
[ Control... ]
Syntax 2 (restoring default settings)
Alter MapInfoDialog dialog_ID Default
dialog_ID is an integer ID number, indicating which MapInfo Pro dialog box to alter.
control_ID is an integer ID number, 1 or larger, indicating which control to modify.
new_value is a new value assigned to the dialog box control.
Description
Use this statement if you need to disable, hide, or assign new values to controls―buttons, check boxes, etc.―in MapInfo Pro's standard dialog boxes.
Determining ID Numbers
To determine a dialog box's ID number, run MapInfo Pro with this command line:
mapinfopro.exe -helpdiagAfter you run MapInfo Pro with the -helpdiag argument, display a MapInfo Pro dialog box and click the Help button. Ordinarily, the Help button launches Help, but because you used the -helpdiag argument, MapInfo Pro displays the ID number of the current dialog box.
Each individual control has an ID number. For example, most OK buttons have an ID number of 1, and most Cancel buttons have an ID number of 2. To determine the ID number for a specific control, you must use a third-party developer's utility, such as the Spy++ utility that Microsoft provides with its C compiler. The MapBasic software does not provide a Spy++ utility.
Although the Alter MapInfoDialog statement changes the initial appearance of a dialog box, the changes do not have any effect unless the user clicks OK. For example, you can use Alter MapInfoDialog to store an address in the Find dialog box; however, MapInfo Pro will not perform the Find operation unless you display the dialog box and the user clicks OK.
Types of Changes Allowed
Use the Disable keyword to disable (gray out) the control.
Use the Hide keyword to make the control disappear.
Use the Value clause to change the setting of the control.
When you alter common dialog boxes (e.g., the Open dialog box), you may reset the item selected in a combo box control, or you may assign new text to static text, button, and edit box controls.
You can change the orientation control in the Page Setup dialog box. The Portrait and Landscape buttons are 1056 and 1057, respectively.
When you alter other MapInfo Pro dialog boxes, the following list summarizes the types of changes you may make.
- Button, static text, edit box, editable combo box: You may assign new text by using a text string in the new_value parameter.
- List box, combo box: You may set which item is selected by using a numeric new_value.
- Checkbox: You may set the checkbox (specify a value of 1) or clear it (value of zero).
- Radio button: Setting a button's value to 1 selects that button from the radio group.
- Symbol style button: You may assign a new symbol style (e.g., use the return value from the MakeSymbol() function).
- Pen style button: You may assign a new Pen value.
- Brush style button: You may assign a new Brush value.
- Font style button: You may assign a new Font value.
- Combined Pen/Brush style button: Specify a Pen value to reset the Pen style, or specify a Brush value to reset the Brush style. (For an example of this type of control, see MapInfo Pro's Region Style dialog box, which appears when you double-click an editable region.)
Example
The following example alters MapInfo Pro's Find dialog box by storing a text string ("23 Main St.") in the first edit box and hiding the Respecify button.
If SystemInfo(SYS_INFO_MIVERSION) = 400 Then
Alter MapInfoDialog 2202
Control 5 Value "23 Main St."
Control 12 Hide
End If
Run Menu Command M_ANALYZE_FIND
The ID number 2202 refers to the Find dialog box. Control 5 is the edit box where the user types an address. Control 12 is the Respecify button, which this example hides. All ID numbers are subject to change in future versions of MapInfo Pro; therefore, this example calls the SystemInfo() function to determine the MapInfo Pro version number.
See Also: