<doc>
	<legacy_id>1138</legacy_id>
	<name>ID</name>
	<type>property</type>

	<syntax>
		<example>set the ID of {<i>image | stack</i>} to <i>number</i></example>
		<example>get the [long | abbr[ev[iated]] | short] ID of <i>object</i></example>
	</syntax>

	<synonyms>
	</synonyms>

	<summary>Reports the unique ID number assigned to an <glossary tag="object">object</glossary>.  </summary>

	<examples>
<example>send mouseUp to button ID 2214</example>
<example>set the ID of image &quot;Custom Cursor&quot; to 2314</example>
<example><p>put the long ID of this card into savedID</p></example>
	</examples>

	<history>
		<introduced version="1.0">Added.  </introduced>
		<deprecated version=""></deprecated>
		<removed version=""></removed>
		
	</history>

	<objects>
		<stack/>
		<card/>
		<group/>
		<field/>
		<button/>
		<graphic/>
		<scrollbar/>
		<player/>
		<image/>
	</objects>

	<platforms>
		<mac/>
		<windows/>
		<linux/>
	  <ios/>
    <android/>
  </platforms>

	<classes>
		<desktop/>
		<server/>
		<web/>
	  <mobile/>
  </classes>

	<security>
	</security>


	<classification>
		<category>Objects &amp; Messages</category>
	</classification>

	<references>
		<command tag="push">push Command</command>
		<command tag="libURLSetLogField">libURLSetLogField Command</command>
		<property tag="altID">altID Property</property>
		<property tag="groupIDs">groupIDs Property</property>
		<property tag="cardIDs">cardIDs Property</property>
	</references>

	<description>
	<overview>Use an object's <b>ID</b> <glossary tag="property">property</glossary> to refer to the <glossary tag="object">object</glossary> in an unambiguous way. </overview>

	<parameters></parameters>

	<value>The <b>ID</b> of an <glossary tag="object">object</glossary> is a non-negative <keyword tag="integer">integer</keyword>. </value>
	<comments>A stack's <b>ID</b> is equal to the <b>ID</b> that will be assigned to the next <glossary tag="object">object</glossary> created within that <object tag="stack">stack</object>, so the <object tag="stack">stack</object> <b>ID</b> is subject to change. You can set the <b>ID</b> of a <object tag="stack">stack</object>, but only to a greater number than its current <b>ID</b>. <p></p><p>You can set the <b>ID</b> of an <keyword tag="image">image</keyword>. Be careful not to set an <keyword tag="image">image</keyword> ID to a number that's the <b>ID</b> of another <glossary tag="object">object</glossary> in the same <object tag="stack">stack</object>:  since LiveCode uses IDs to keep track of <glossary tag="object">objects</glossary>, a conflict may prevent LiveCode from being able to access one or both <glossary tag="object">objects</glossary>. The following ID numbers are reserved and should not be used for <keyword tag="image">image</keyword> IDs:</p><p></p><p>&#9;* 1-100: reserved for built-in cursors</p><p>&#9;* 101-135: reserved for built-in brush shapes</p><p>&#9;* 236-300: reserved for built-in patterns</p><p>&#9;* 301-1000: reserved for built-in icons</p><p>&#9;* 101,000-103,000: reserved</p><p>&#9;* 200,000-299,999: reserved for application use</p><p></p><p>For all other objects, the <b>ID</b> <glossary tag="property">property</glossary> is assigned when the <glossary tag="object">object</glossary> is created and never changes. This means that for all <glossary tag="object">objects</glossary> except <function tag="stacks">stacks</function> and <glossary tag="image">images</glossary>, the <b>ID</b> <glossary tag="property">property</glossary> is guaranteed to be persistent. An <glossary tag="object">object's</glossary> <property tag="name">name</property> or <function tag="number">number</function> may change, but its <b>ID</b> does not. </p><p></p><p>For all objects, the <b>ID</b> is guaranteed to be unique within a <object tag="stack">stack</object>. IDs are not reused if the <glossary tag="object">object</glossary> is deleted. </p><p></p><p></p><note>An <glossary tag="object">object</glossary> that is created by copying and pasting, or with the <command tag="copy">copy</command> <glossary tag="command">command</glossary>, is assigned a new <b>ID</b>. If you cut an <glossary tag="object">object</glossary> and paste it into the same <object tag="stack">stack</object>, it retains its original <b>ID</b>. </note><p></p><p>The short ID of an object is its ID number. If you don't specify a modifier for the ID property, you get the short ID form. </p><p></p><p>The abbreviated ID of an object is the object's type, followed by &quot;id&quot;, followed by the object's short ID. For example, if a button's short ID is &quot;27&quot;, its abbreviated ID is &quot;button id 27&quot;. </p><p></p><p>The long id of an object includes information about its <b>owner</b> (and about the <property tag="owner">owner</property> of that <glossary tag="object">object</glossary>, and so forth). For example, suppose a <object tag="stack">stack</object> named &quot;My Stack&quot; contains a <keyword tag="card">card</keyword> whose ID is 11. This <keyword tag="card">card</keyword> has a <command tag="group">group</command> whose ID is 28, which in turn contains a <keyword tag="button">button</keyword> whose ID is 34. The <keyword tag="card">card</keyword> also has a <glossary tag="card control">card field</glossary> whose ID is 46. If &quot;My Stack&quot; is a <glossary tag="main stack">main stack</glossary> and it's in a <keyword tag="file">file</keyword> whose <glossary tag="file path">path</glossary> is &quot;/Drive/Folder/Stack. rev&quot;, the long IDs of these <glossary tag="object">objects</glossary> look like this:</p><p>&#9;* The stack: stack &quot;/Drive/Folder/Stack. rev&quot;</p><p>&#9;* The group: group id 28 of card ID 11 of stack &quot;/Drive/Folder/Stack. rev&quot;</p><p>&#9;* The card: card id 11 of stack &quot;/Drive/Folder/Stack. rev&quot;</p><p>&#9;* The grouped button: button id 34 of group id 28 of card id 11 of stack &quot;/Drive/Folder/Stack. rev&quot;</p><p>&#9;* The card field: field id 46 of card id 11 of stack &quot;/Drive/Folder/Stack. rev&quot;</p><p>If the stack is a substack, its <b>ID</b> is included in the long <property tag="name">name</property> of each of its <glossary tag="object">objects</glossary>, before the <glossary tag="file path">path</glossary> of the <glossary tag="main stack">main stack</glossary>. </p><p></p><p>The long ID of a group includes the <b>ID</b> of the <glossary tag="current card">current card</glossary>. If the <command tag="group">group</command> does not appear on the <glossary tag="current card">current card</glossary>, requesting its <b>ID</b> causes an <glossary tag="execution error">execution error</glossary>. If you need to get the <b>ID</b> of a <command tag="group">group</command>, use the &quot;<object tag="group">background</object>&quot; terminology instead. </p><p></p><p>The long ID of a background includes the <b>ID</b> of the <glossary tag="current card">current card</glossary>, if the <object tag="group">background</object> appears on the <glossary tag="current card">current card</glossary>. If not, the long <b>ID</b> of the <object tag="group">background</object> includes the ID of the first <keyword tag="card">card</keyword> the <object tag="group">background</object> appears on. </p><p></p><p>If an object's <b>name</b> is empty, getting its <property tag="name">name</property> yields its <b>ID</b> <glossary tag="property">property</glossary> instead. </p><p></p><p></p><important>If a <object tag="stack">stack</object> was originally created with <keyword tag="top">HyperCard</keyword> and then imported into LiveCode, the <b>ID</b> of each <keyword tag="control">control</keyword> in the <object tag="stack">stack</object> is guaranteed unique only within its <glossary tag="domain">domain</glossary>. (You can check a <glossary tag="stack">stack's</glossary> <property tag="HCStack">HCStack</property> <glossary tag="property">property</glossary> to determine whether it began life in <keyword tag="top">HyperCard</keyword>. )</important><p></p><p></p><note>If a <glossary tag="stack">stack's</glossary> <property tag="HCAddressing">HCAddressing</property> <glossary tag="property">property</glossary> is set to true, the <keyword tag="long">long</keyword> or <keyword tag="abbreviated">abbreviated</keyword> <b>ID</b> of a <keyword tag="control">control</keyword> in that <object tag="stack">stack</object> begins with the word &quot;background&quot; if the <keyword tag="control">control</keyword> is part of a <command tag="group">group</command>, and with the word &quot;card&quot; if not. </note></comments>
	</description>
</doc>