The Maxobj Object
A Maxobj is a Javascript representation of a Max object in a patcher. It is returned by various methods of a Javascript Patcher object, such as newobject().One important thing to keep in mind about a Maxobj is that it could eventually refer to an object that no longer exists if the underlying Max object is freed. The valid property can be used to test for this condition.
Maxobj Properties
rect (Array, get/set)
The location of an object in a patcher. When the object's rectangle is changed, it will move on screen if it is visible. The coordinates are stored in the following order: left, top, right, bottom.
maxclass (String, get)
The Max class (as opposed to the Javascript class, which is "Maxobj" and accessed via the standard class property) of the object.
patcher (Patcher, get)
The Patcher object that contains the Maxobj
hidden (Boolean, get/set)
Is the object set to be hidden in a locked patcher?
colorindex (Number, set/get)
If the object is set to use one of the standard 16 colors, this property is the index of the color
nextobject (Maxobj, get)
If there is another object after this one in the Patcher's list of objects, this property returns it, otherwise it returns a nil value
varname (String, get/set)
The patcher-specific name of the object, as set with the Name... dialog
canhilite (Boolean, get)
Whether the object can be selected for text entry (a number box would be an example of an object whose canhilite property returns true)
background (Boolean, get/set)
Whether the object is in the Patcher's background layer
ignoreclick (Boolean, get/set)
Whether the object ignores clicks
selected (Boolean, get)
Whether the object is selected in an unlocked patcher window.
js (jsthis, get)
If the Maxobj refers to an object is of Max class js, this returns the associated jsthis object
valid (Boolean, get)
Returns whether the Maxobj refers to a valid Max object
Maxobj Methods
Perhaps the most powerful thing about a Maxobj is that you can send any message to a Maxobj that you can send to a Max object in Max as if you were invoking a method on the object in Javascript. For example, if you had a number box Maxobj and you wanted to set its value to 23 without outputting the value, you could do this:
  n.set(23);
Note that certain words such as int, float, and delete are keywords in Javascript, and you will need to use either array notation or the message method for such reserved words. For example:
  
  n["int"] = 23;
  //or
  n.message("int", 23);
The following methods are common to all Maxobj objects.
message (string, …)
Sends the object the message specified by the string, followed by any additional arguments provided. This is useful for sending messages to object which dynamically dispatch messages with the “anything” message, as is the case for instances of js, jsui, lcd, and others.
help ()
Opens a help file describing the object, if it exists
subpatcher (index)
If the object contains a patcher, this function returns a (Javascript) Patcher object. The optional index is used for specifying an instance number, which only applies to poly~ objects. If the object does not contain a subpatcher, a nil value is returned.
understands (string)
Returns a Boolean value if the object has an entry in its message list for the message specified by the string. If the entry is not a message that can be sent by a user within Max (i.e., it's a C-level “untyped” message), false is returned. This doesn’t work for messages which are dynamically dispatched with the “anything” message, as is the case for instances of js, jsui, lcd, and others.