Stay organized with collections
Save and categorize content based on your preferences.
blockly > Events > BlockMove > setReason
Events.BlockMove.setReason() method
Set the reason for a move event.
Signature:
setReason(reason: string[]): void;
Parameters
Parameter |
Type |
Description |
reason |
string[] |
Why is this move happening? 'drag', 'bump', 'snap', ... |
Returns:
void
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eEvents.BlockMove.setReason()\u003c/code\u003e method allows you to specify the cause of a block move event, such as dragging, bumping, or snapping.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts a string array representing the reason for the move and does not return any value.\u003c/p\u003e\n"]]],["The `setReason()` method within the `BlockMove` event class is used to define the cause of a block's movement. It accepts an array of strings as input, with each string detailing a reason for the move, such as 'drag', 'bump', or 'snap'. This method has no return value. The reason parameter is a list of strings explaining why the block is moved.\n"],null,["[blockly](./blockly.md) \\\u003e [Events](./blockly.events_namespace.md) \\\u003e [BlockMove](./blockly.events_namespace.blockmove_class.md) \\\u003e [setReason](./blockly.events_namespace.blockmove_class.setreason_1_method.md)\n\nEvents.BlockMove.setReason() method\n-----------------------------------\n\nSet the reason for a move event.\n\n**Signature:** \n\n setReason(reason: string[]): void;\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|-----------|------------|---------------------------------------------------------|\n| reason | string\\[\\] | Why is this move happening? 'drag', 'bump', 'snap', ... |\n\n**Returns:**\n\nvoid"]]