Set Code
set_codeReplace the entire code of a method, event handler, or code item in the open Xojo project. Overwrites all existing code; use edit_code for partial changes.
Instructions
Replaces the whole code of one method, event handler or other code item in the open Xojo project: the item at location, or the one open in the code editor when location is omitted. Everything the item held is overwritten, so for a change to existing code prefer edit_code, which sends only the part that changes. The name, parameters and return type are not part of the code; set_declaration changes those. A path that does not exist, or an item with no code editor, is an error and nothing is written. Reaches the same items as get_code. The change stays in the IDE until save_project. Needs the Xojo IDE running with the project open.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The item's new code, replacing all of it | |
| location | No | Dot-separated path, as for get_code. Omit for the item open in the code editor. |