Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit b217038

Browse files
authored
Merge pull request #4601 from bhall2001/bugfix-18357
[[ Bug 18357 ]] Dispatch command array as argument
2 parents deeeea9 + 755fcfb commit b217038

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

docs/dictionary/command/dispatch.lcdoc

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,36 @@ Example:
1717
dispatch "updateWidget"
1818

1919
Example:
20-
dispatch "setList" with tNewList
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
32+
33+
Example:
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
2150

2251
Parameters:
2352
message:
@@ -28,6 +57,7 @@ A reference to any LiveCode object.
2857

2958
argumentList:
3059
A comma separated list of expressions containing the arguments to send.
60+
Arrays are expressions and are valid to send as arguments.
3161

3262
It (enum):
3363
Set by <dispatch> to indicate how the message was processed.
@@ -38,7 +68,7 @@ Set by <dispatch> to indicate how the message was processed.
3868

3969

4070
Description:
41-
Use the <dispatch> command to send a mesage to an object, via the
71+
Use the <dispatch> command to send a message to an object, via the
4272
message path and find out whether it was handled or not.
4373

4474
The <dispatch> command is most useful when using <behavior|behaviors>,

docs/notes/bugfix-18357.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# dispatch documentation should mention arguments can be arrays

0 commit comments

Comments
 (0)