Home THE HYPERCARD CENTER

HyperTalk Reference
Home » HyperTalk Reference » Keywords

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

on

on messageName [parameterList]
    statements
end messageName


The on keyword defines a new message handler of the specified name.


The optional parameterList lets the handler receive values sent along with a message. HyperCard assigns each value to a parameter variable in the parameterList.


Demo Script

on mouseUp
   flashTheButton "bkgnd btn id 57",2
 end mouseUp
 

 on flashTheButton whichBtn, howMany
   repeat for (howMany * 2) times
     set the hilite of whichBtn to not the hilite of whichBtn
   end repeat
 end flashTheButton

Placeholders

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


statements
Any return-separated list of built-in commands, user-defined handlers, or keywords that are part of a message or function handler.

put "Hello world"   -- built-in command
get total(field 1)  -- function call
global HelpInfo     -- keyword


Related Topics

« if (single-statement) | HyperTalk Reference | pass »


Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Modern View

Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » Keywords

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

on

on messageName [parameterList]
    statements
end messageName


The on keyword defines a new message handler of the specified name.


The optional parameterList lets the handler receive values sent along with a message. HyperCard assigns each value to a parameter variable in the parameterList.


Demo Script

on mouseUp
   flashTheButton "bkgnd btn id 57",2
 end mouseUp
 

 on flashTheButton whichBtn, howMany
   repeat for (howMany * 2) times
     set the hilite of whichBtn to not the hilite of whichBtn
   end repeat
 end flashTheButton

Placeholders

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


statements
Any return-separated list of built-in commands, user-defined handlers, or keywords that are part of a message or function handler.

put "Hello world"   -- built-in command
get total(field 1)  -- function call
global HelpInfo     -- keyword


Related Topics

« if (single-statement) | HyperTalk Reference | pass »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View