A newer version of Max is available. Click here to access the latest version of this document.

patcher

Create a subpatch within a patch

Description

patcher facilitates the modularization of patches within patches. Take a patch contained within a single patcher window, place it within a patcher object, add inlet s and outlet s, and you can instantiate it as an object (or many copies of that object) capable of its own messaging, embedded within a larger patch.

The number of inlets in a patcher object is determined by the number of inlet objects contained within its subpatch window. The messaging which the patcher object can handle depends upon the patch you embed within it.

Double-clicking on a patcher object with the mouse opens the subpatcher in a new window.

Arguments

Name Type Opt Description
subpatch-name symbol opt The subpatch can be given a name by the argument, so that its name appears in the title bar of the subpatch window. The name in the title bar of the subpatch window is displayed in brackets to indicate that it is part of another file. If there is no argument typed in, the subpatch window is named [sub patch]. Different patcher objects that share the same name are still distinct subpatches, and do not share the same contents.

Attributes

Name Type g/s Description
bgcolor float Sets the background color in RGBA format.
boxanimatetime int Sets the rate, in milliseconds, used for animation of object behavior in the patcher window.
default_fontface int Sets the default type style. 0 is plain (regular), 1 is bold, 2 is italic, and 3 is bold italic.
default_fontname symbol Sets the default font name.
default_fontsize float Sets the default font size (in points).
defaultfocusbox symbol Sets the patcher window to get the focus by default.
edit_framecolor float Sets the color of the outline/halo that appears around an object or message box when the object is being edited in RGBA format.
editing_bgcolor float Sets the background color displayed when the windows is being edited in RGBA format.
enablehscroll int Toggles horizontal scrollbar display in a patcher window.
enablevscroll int Toggles vertical scrollbar display in a patcher window.
filepath symbol (get) Sets the filepath for the patcher window.
globalpatchername symbol Sets the global name by which this patcher can be referred to by pattr objects (for more information, see the pattrmarker object).
gridonopen int Toggles displaying the grid in the patcher window when unlocked.
gridsize float Sets the grid size in pixels.
gridsnaponopen int Toggles automatically setting the "Snap To Grid" option when the patcher is unlocked.
imprint int Toggles saving default-valued object attributes.
openinpresentation int Toggles opening the patcher in Presentation mode automatically.
openrect float Sets the fixed initial window position (vertical offset/horizontal offset/height/width) for the patcher window.
title symbol Sets the title which appears in the patcher window.
toolbarvisible int Toggles showing the toolbar when the patcher is opened.

Information for box attributes common to all objects

Output

anything: The number of outlets a patcher object has is determined by the number of outlet objects contained within the subpatch window. Output can also be sent via send and value objects contained in the subpatch. The actual messages sent out of a patcher object depend on the contents of the subpatch.

When a patcher object is first created, the subpatch window is automatically opened for editing. To view or edit the contents of a patcher object (or any subpatch object) later on, double-click on the object when the patcher window is locked.

All the objects in a subpatch of a patcher object are saved as part of the patcher which contains the object.

Examples

A patch can be contained (and saved) as part of another patch

See Also

Name Description
bpatcher Embed a visible subpatch inside a box
inlet Receive messages from outside a patcher
outlet Send messages out of a patcher
pcontrol Open and close subwindows within a patcher
thispatcher Send messages to a patcher
Max Basic Tutorial 14: Encapsulation Max Basic Tutorial 14: Encapsulation
Max pattr Tutorial 1: Patcher Storage Max pattr Tutorial 1: Patcher Storage