Set Declaration
set_declarationSets the name, type, scope, and parameters of the current Xojo method or property, completing blank items created in the IDE. Pass current values to keep fields unchanged.
Instructions
Sets the name, type, scope and parameters of the CURRENT method or property in the Xojo IDE. This is the other half of create_project_item: DoCommand "NewProperty" creates a blank, untyped property, and this is what names and types it. NOTE the two argument meanings — for a METHOD, parameters is the parameter list ('x As Integer, y As Integer') and data_type is the return type; for a PROPERTY, parameters is the DEFAULT VALUE and data_type is the property's type. Every field is replaced, so pass the current values of those you are keeping. Returns 'OK: '. A constant or other item kind is refused with an error that names it, as is a location that does not exist. The change stays in the IDE until save_project. Needs the Xojo IDE running with the project open.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The method's or property's name, new or unchanged | |
| scope | No | 'Public' (default), 'Protected' or 'Private' | |
| location | No | Dot-separated path to select first (e.g. 'Window1.MyMethod'). Omit to act on whatever is already current — which is what you want directly after create_project_item. | |
| data_type | No | For a property, its type ('String', 'Integer'). For a method, its return type. Omit for a method that returns nothing. | |
| implements | No | Interface member this implements, e.g. 'Readable.Read'. Omit if none. | |
| parameters | No | For a method, the parameter list ('x As Integer, y As Integer'). For a property, the default value. |