Get Code
get_codeFetches the body code for a Xojo method, event handler, or other code item by location or from the active code editor so you can copy the exact old_string for edit_code.
Instructions
Returns the 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. Giving a location also selects that item in the Navigator. A path that does not exist, or an item with no code editor, is an error; an empty body says so. The code is the body only: the declaration line is not included. Window and control event handlers are reachable on Xojo 2026r3 and later; on earlier releases read the .xojo_window file instead. Copy edit_code's old_string from this output. Needs the Xojo IDE running with the project open.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| location | No | Dot-separated path, e.g. 'Module1.Method1', 'Window1.Opening' or 'Window1.Controls.Button1.Pressed' (note the Controls segment). Omit for the item open in the code editor. |