Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » menuMessage

Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page.

menuMessage

set [the] menuMessage of menuItem of menu to "messageName [parameterList]"

The menuMessage property returns or sets the message sent to the current card when the user chooses a menu item from a menu.

The menuMessage property returns empty if the menu item has no associated message.

HyperCard’s default menu items have no associated messages sent to the current card unless they have been explicitly set with this property.

A doMenu handler can override a menuMessage.

Examples

get the menuMessage of menuItem 1 of menu "Help"
if it is not empty then ...
set the menuMessage of menuItem "Print" of menu "File" to "myPrint"
set the menuMsg of menuItem 2 of menu 2 to "beep"
set the menuMsg of second menuItem of second menu to ¬
"set the visible of field 1 to not the visible of field 1"

Related Topics

Placeholders

menuItem

An expression that evaluates to one of the following:

menuItem text
menuItem posInteger
ordinal menuItem

For example:

menuItem "New"
menuItem 2
second menuItem

menu

An expression that evaluates to one of the following:

menu text
menu posInteger
ordinal menu

For example:

menu "File"
menu 2
second menu

messageName

Any text string, without quotation marks, that represents the name of the message handler you want to write:

calculateDebt
selectWholeLine

As in:

on calculateDebt
on selectWholeLine theLine, aContainer

parameterList

A comma-separated list of local variable names.

The actual names don’t matter as long as they’re not the same as one of HyperCard’s reserved words. (That is, don’t use result as a variable name.) For example:

var1
var1,var2,var3, var4
fieldName, N, numberOfCharacters

HyperTalk Reference

Version 0.8b4 (July 4, 2025)

Made with Macintosh

Switch to Retro View