Skip to content

id

by admin on May 24th, 2016

The “ID” is an identification number that each object in your project gets, that does not change over its lifetime. You can not change the ID of an object, but it also does not change if you move the object e.g. in the onscreen stacking order or when you change its name. This can be useful for identifying objects that change order a lot, or objects whose name changes as it indicates some state to the user, from a script.

IDs are unique within the container for a particular object. That is, there is a guarantee that no two stacks in the same project will have the same ID number, nor two parts on the same card, or two buttons on the same background, or two menu items in the same menu, or two menus in the same project etc.

put the ID of card button 1 into myOnOffSwitchButtonID

If an object has the “ID” property (projects, for example, do not have an ID number, as Stacksmith can not prevent the user from duplicating a project in Finder), you can also refer to it by ID, simply by specifying “id” and the number (or a variable containing the number). So for example:

put the name of card button id myOnOffSwitchButtonID into switchState
put the commandCharacter of menuItem id 100 of menu "File" into theShortcutKey

Note: While currently Stacksmith will prefer certain number ranges for the ID numbers of certain object types (e.g. cards and backgrounds in the 1000s, menus and menu items in the 100s etc.) an object’s ID number can be any valid number, positive or negative. In particular, stacks imported from HyperCard will have the ID number -1.

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS