Control PopupMenu 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 popup menu control to the dialog box.

Syntax

Control PopupMenu 
	[ Position x, y ]
	[ Width w ] 
	[ ID control_ID ] 
	[ Calling handler ] 
	[ Title { str_expr | From Variable str_array_var } ] 
	[ Value i_selected ] 
	[ Into i_variable ] 
	[ Disable ] 

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

w specifies the control's width, in dialog box units; default width is 80.

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 when the user chooses an item from the menu.

str_expr is a string expression, containing a semicolon-delimited list of items to appear in the control.

str_array_var is the name of an array of string variables.

i_selected is a SmallInt value indicating which item should appear selected when the dialog box first appears: a value of one selects the first item; if the clause is omitted, the first item appears selected.

i_variable is the name of a SmallInt variable which stores the user's final selection (one, if the first item selected, etc.).

The Disable keyword makes the control disabled (grayed out) initially.

Description

If a Dialog statement includes a Control PopupMenu clause, the dialog box includes a pop-up menu. A pop-up menu is a list of items, one of which is selected at one time. Initially, only the selected item appears on the dialog box.

If the user clicks on the control, the entire menu appears, and the user can choose a different item from the menu.

The Title clause specifies the list of items that appear in the menu. If the Title clause specifies a string expression containing a semicolon-delimited list of items, each item appears as one item in the menu. The following sample Title clause demonstrates this syntax:

Title "Town;County;Territory;Region;Entire state"

Alternately, the Title clause can specify an array of string variables, in which case each entry in the array appears as one item in the popup menu.

The following sample Title clause demonstrates this syntax:

Title From Variable s_optionlist

Example

Control PopupMenu 
	Title "Town;County;Territory;Region;Entire state"
	Value 2
	ID 5 
	Into i_map_scope
	Position 10, 150 

See Also:

Alter Control statement, Dialog statement, ReadControlValue() function