Create Project Item
create_project_itemAdds a new class, method, module, or other item to the open Xojo project using the IDE's own command, returning its location so you can name and type it next.
Instructions
Creates a new item in the open Xojo project with the IDE's own command for it, inside parent_location (selected first) or the currently selected item, and returns the new item's location. A new method or property is blank and untitled (e.g. 'Window1.Untitled') and stays selected, so name and type it with set_declaration straight afterwards, with no location. Use this, never a hand edit of the .xojo_project file, to add items: the IDE assigns their IDs. The item stays in the IDE until save_project. There is no matching delete: Xojo's IDE scripting has no command for it. Delete a member by removing its #tag block from the item's file on disk; a whole item has to be deleted by the user in the IDE. Needs the Xojo IDE running with the project open.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item_type | Yes | Item type to create. Must be one of: NewClass, NewModule, NewMethod, NewProperty, NewConstant, NewEvent, NewNote, NewMenuHandler, NewComputedProperty, NewSharedMethod, NewSharedProperty, NewEnum, NewStructure, NewDelegate, NewInterface, NewWindow, NewContainerControl, NewFolder, AddEventImplementation | |
| parent_location | No | Dot-separated path of the item to create inside, e.g. 'Module1' or 'Window1'; selected first. Omit to use the current selection. |