Scaffold Code Block
scaffold_code_blockGenerate correctly formatted Xojo #tag blocks for methods, properties, constants, and event handlers instead of writing IDE syntax from memory. Returns text to insert before linting.
Instructions
Generates a correctly formatted #tag block for a .xojo_code or .xojo_window file: a method, shared method, property, constant, event definition (#tag Hook), control event handler (#tag Events block) or window event handler. Use it instead of writing #tag syntax from memory when editing a project file on disk: it pairs each Flags value with its visibility keyword, escapes a constant's Default value, and indents the body the way the IDE does. It only returns text; insert it yourself, in the block order usage-guide.md's Format Rules give and before #tag ViewBehavior, then check the file with lint_project_file. A control_event result is a whole #tag Events block: if the control already has one, insert just its inner #tag Event … #tag EndEvent. An argument that does not apply to block_kind, a name that is not a Xojo identifier, or a constant value it cannot escape safely is an error. Reads no files and needs no IDE.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | Code for a method or event handler, one statement per line; indent nested blocks with two spaces. Omit for an empty body | |
| name | Yes | The member's name; for control_event, the control's name (e.g. Button1); for window_event, the event's name (e.g. Opening) | |
| type | No | property: its data type (required). constant: String, Integer, Double, Boolean or Color (default String) | |
| event | No | control_event only: the event's name, e.g. Pressed | |
| signature | No | Parameter list and optional return type, e.g. '(count As Integer) As String'. A return type makes it a Function. Defaults to '()' | |
| block_kind | Yes | method, shared_method, property, constant, event_definition, control_event, or window_event | |
| visibility | No | public, protected or private (method, shared_method, property, constant); default public. In a module, public means global | |
| default_value | No | constant only: the raw, unescaped value; this tool escapes it |