Name: newButton

Type: message

Syntax: newButton

Summary:
Sent to a new button right after it's created.

Associations: button

Introduced: 1.0

OS: mac, windows, linux, ios, android

Platforms: desktop, server, mobile

Example:
on newButton -- put new buttons at a random location
  set the location of the target to \
  random(the width of this stack - the width of the target div 2), \
  random(the height of this stack - the height of the target div 2)
end newButton

Description:
Handle the <newButton> <message> if you want to create additional
<object|objects>, switch <tool|tools>, or do other tasks when a new
<button(object)> is created.

Normally, the <newButton> <message> is handled at a higher level of the
<message path>, since the newly created <button(object)> does not yet
have a <script> unless the <templateButton> contains one.

The actual creation is not triggered by the <newButton> <message>, so
<trap|trapping> the <message> and not allowing it to <pass> does not
prevent the <button(object)> from being created.

References: copy (command), clone (command), paste (command),
pass (control structure), object (glossary), trap (glossary),
message (glossary), tool (glossary), message path (glossary),
templateButton (keyword), button (object), script (property)

Tags: objects

