Home THE HYPERCARD CENTER

HyperTalk Reference
Home » HyperTalk Reference » Commands

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

delete

delete chunk of container
delete 
[menuItem of] menu delete [menuItem from] menu delete {button | field |part }



The delete 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.

When you use the form delete part , deleteButton or deleteField is sent to the object that's being deleted.

You can't use this command to delete a part anywhere except on the current card.

Note: Using delete to delete a line is not the same as putting empty into the line: delete removes the final return character as well as the text, while putting empty into the line just removes the text.


Examples

delete item 3 of line 1 of field "Expenses"
delete line 5 of button "Text Holder"

put " this has a space" into theText
delete character 1 of theText

delete menu "File"
delete menu 2
delete second menu

delete menuItem "New" from menu "File"
delete menuItem 2 from menu 2
delete second menuItem from second menu

delete button 1
delete last card field
delete background button id 1234
delete last background part

Demo Script

on surpriseDelete
  -- appropriate surprise with style
  set the cantModify of this stack to true -- to easily restore the text
  find string "ropriate surprise with sty"
  wait 1 sec
  delete the foundChunk
  wait 1 sec
  set cantModify of this stack to false
end surpriseDelete

Placeholders

chunk
One of the following forms (or combinations thereof):

ordinal charactercharacter posInteger [to posInteger ]ordinal wordword posInteger [to posInteger ]ordinal itemitem posInteger [to posInteger ]ordinal lineline posInteger [to posInteger ]

For example:

first character
second item
middle line
character 1
char 1 to 10
word 3
item 5 to (the number of items of me)
line 1 to 10
char 1 to 10 of word 2 to 4 of ¬
line 3 to 6
A chunk combined with of and a container is called a chunk expression. For example:
line 1 of card field "index"


Important: You can’t combine a stack name with a chunk expression—you can only refer to a chunk in the current stack.

container
HyperTalk DefinitionA place where you can store and retrieve a value.

There are six types of containers in HyperCard: a variable, a button, a field, the selection, the Message box, and menus.

myVariable
[the] selection
the Message box
btn 3
bg btn "Names"
card field 1
bkgnd field "Total"
menu 2
menu "Edit"
Additionally, you can refer to a button or field by its part number:

card part 1
last background part
AppleScript DefinitionAn object that contains one or more other objects, known as elements of the container. In a reference, the container specifies where to find an object. You specify containers with the reserved words of or in.

You can also use the possesive form ('s) to specify containers. For example, in

first window's name
the container is first window. The object it contains is a name property.

menu
An expression that evaluates to one of the following:

menu text
menu posInteger
ordinal menu
For example:

menu "File"
menu 2
second menu


part
An expression that identifies a button or field by its ordinal position among all buttons and fields on the same card or bkgnd.

A button's or field’s part number is available in its Info dialog box; in a script, it is available in the object’s partNumber property.

You can use any of these forms:

[card] part posInteger [bg] part posInteger ordinal [card] [bg] partFor example:

card part 5
first card part
last background part


Related Topics

« debug | HyperTalk Reference | dial »


Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Modern View

Home
The HyperCard Center
HyperTalk Reference
Home » HyperTalk Reference » Commands

Note: This is a work in progress and will be formatting errors. Read more about the project on the home page.

delete

delete chunk of container
delete 
[menuItem of] menu delete [menuItem from] menu delete {button | field |part }



The delete 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.

When you use the form delete part , deleteButton or deleteField is sent to the object that's being deleted.

You can't use this command to delete a part anywhere except on the current card.

Note: Using delete to delete a line is not the same as putting empty into the line: delete removes the final return character as well as the text, while putting empty into the line just removes the text.


Examples

delete item 3 of line 1 of field "Expenses"
delete line 5 of button "Text Holder"

put " this has a space" into theText
delete character 1 of theText

delete menu "File"
delete menu 2
delete second menu

delete menuItem "New" from menu "File"
delete menuItem 2 from menu 2
delete second menuItem from second menu

delete button 1
delete last card field
delete background button id 1234
delete last background part

Demo Script

on surpriseDelete
  -- appropriate surprise with style
  set the cantModify of this stack to true -- to easily restore the text
  find string "ropriate surprise with sty"
  wait 1 sec
  delete the foundChunk
  wait 1 sec
  set cantModify of this stack to false
end surpriseDelete

Placeholders

chunk
One of the following forms (or combinations thereof):

ordinal charactercharacter posInteger [to posInteger ]ordinal wordword posInteger [to posInteger ]ordinal itemitem posInteger [to posInteger ]ordinal lineline posInteger [to posInteger ]

For example:

first character
second item
middle line
character 1
char 1 to 10
word 3
item 5 to (the number of items of me)
line 1 to 10
char 1 to 10 of word 2 to 4 of ¬
line 3 to 6
A chunk combined with of and a container is called a chunk expression. For example:
line 1 of card field "index"


Important: You can’t combine a stack name with a chunk expression—you can only refer to a chunk in the current stack.

container
HyperTalk DefinitionA place where you can store and retrieve a value.

There are six types of containers in HyperCard: a variable, a button, a field, the selection, the Message box, and menus.

myVariable
[the] selection
the Message box
btn 3
bg btn "Names"
card field 1
bkgnd field "Total"
menu 2
menu "Edit"
Additionally, you can refer to a button or field by its part number:

card part 1
last background part
AppleScript DefinitionAn object that contains one or more other objects, known as elements of the container. In a reference, the container specifies where to find an object. You specify containers with the reserved words of or in.

You can also use the possesive form ('s) to specify containers. For example, in

first window's name
the container is first window. The object it contains is a name property.

menu
An expression that evaluates to one of the following:

menu text
menu posInteger
ordinal menu
For example:

menu "File"
menu 2
second menu


part
An expression that identifies a button or field by its ordinal position among all buttons and fields on the same card or bkgnd.

A button's or field’s part number is available in its Info dialog box; in a script, it is available in the object’s partNumber property.

You can use any of these forms:

[card] part posInteger [bg] part posInteger ordinal [card] [bg] partFor example:

card part 5
first card part
last background part


Related Topics

« debug | HyperTalk Reference | dial »

Version 0.7b1 (March 24, 2022)

Made with Macintosh

Switch to Retro View