@@ -2,7 +2,6 @@ Name: dispatch
22
33Type: command
44
5- Syntax: dispatch <message> [ to <target> ][ with {<argumentList>, | arrayName} ]
65Syntax: dispatch <message> [ to <target> ][ with <argumentList> ]
76
87Summary:
@@ -18,9 +17,36 @@ Example:
1817dispatch "updateWidget"
1918
2019Example:
21- dispatch "setList" with myVar1, myVar2
20+ on mouseUp
21+ local tWidth, tHeight
22+
23+ put 200 into tWidth
24+ put 100 into tHeight
25+ dispatch "setSize" with tWidth, tHeight
26+ end mouseUp
27+
28+ on setSize pWidth, pHeight
29+ set the width of graphic "myRectangle" to pWidth
30+ set the height of graphic "myRectangle" to pHeight
31+ end setSize
2232
2333Example:
34+ # An example of using an array as an argument
35+
36+ on mouseUp
37+ local tDataArray
38+
39+ put "Mickey" into tDataArray["firstName"]
40+ put "Mouse" into tDataArray["lastName"]
41+
42+ dispatch "updateUI" to card "myCard" with "Hello World", tDataArray
43+ end mouseUp
44+
45+ on updateUI pTitle, @pArray
46+ put pTitle into field "Title"
47+ put pArray["firstName"] into field "First Name"
48+ put pArray["lastName"] into field "Last Name"
49+ end updateUI
2450
2551Parameters:
2652message:
@@ -31,7 +57,7 @@ A reference to any LiveCode object.
3157
3258argumentList:
3359A comma separated list of expressions containing the arguments to send.
34-
60+ Arrays are expressions and are valid to send as arguments.
3561
3662It (enum):
3763Set by <dispatch> to indicate how the message was processed.
@@ -50,6 +76,8 @@ as it allows a <behavior> script to send an 'event' to one of its child
5076objects and then perform an action depending on the outcome.
5177
5278Executing a <dispatch> command causes the <message> to be sent to the
79+ target object with the given argument list. This message passes through
80+ the message path in the normal way.
5381
5482If no <target> is specified, the <message> is sent to ' <me> '. In the
5583context of a <behavior>, this is typically the child that is executing
0 commit comments