{"identifier":34478,"topic":"Commands","name":"delete","text":"<code><pre>delete <i>chunk<\/i> of <i>container<\/i>\ndelete <\/pre><\/code>[<i><code>menuItem<\/i> of<\/pre><\/code>]<code> <i>menu<\/i><\/pre><\/code> <code>delete <\/code>[<i><code>menuItem<\/i> from<\/code>]<code> <i>menu<\/i><\/code> <code>delete <\/code>{<i><code>button<\/i><\/code> | <i><code>field<\/i><\/code>  |<i><code>part<\/i><\/code> } <br><br>\n\n <br><br>\n\n The<code> delete <\/code>command removes text from a container, menu items from a menu,  menus from the menu bar, and buttons or fields from the current card or background.  <br><br>\n\n When you use the form <code>delete <i>part<\/i><\/code> , <code> deleteButton <\/code>or<code> deleteField <\/code>is sent to the object that's being deleted. <br>\n<br>\nYou can't use this command to delete a <i><code>part<\/i><\/code>  anywhere except on the current card. <br><br>\n\n Note: Using<code> delete <\/code>to delete a line is not the same as putting<code> empty <\/code>into the line:<code> delete <\/code>removes the final<code> return <\/code>character as well as the text, while putting<code> empty <\/code>into the line just removes the text. <br>\n","related":{"24266":null,"34927":null,"45460":"put"},"examples":"delete item 3 of line 1 of field \"Expenses\"\ndelete line 5 of button \"Text Holder\"\n\nput \" this has a space\" into theText\ndelete character 1 of theText\n\ndelete menu \"File\"\ndelete menu 2\ndelete second menu\n\ndelete menuItem \"New\" from menu \"File\"\ndelete menuItem 2 from menu 2\ndelete second menuItem from second menu\n\ndelete button 1\ndelete last card field\ndelete background button id 1234\ndelete last background part","demo":"<code><pre>on surpriseDelete\n  -- appropriate surprise with style\n  set the cantModify of this stack to true -- to easily restore the text\n  find string \"ropriate surprise with sty\"\n  wait 1 sec\n  <b>delete<\/b> the foundChunk\n  wait 1 sec\n  set cantModify of this stack to false\nend surpriseDelete<\/pre><\/code>\n ","debug":{"9":["delete chunk of cont"],"10":["You can't use this c"]}}