Hi all. Here is a handy snippet for saving a stacks location, which is multi-monitor aware. It creates an array of key value pairs for any monitor resolution a stack is in when this function is called. The key is the monitor resolution and the value is the loc of the stack passed as pTargetStack. pTargetStack must be the stack name, or else the long stack name. In other words it must begin with the word "stack".
I have gotten into the habit of always using long stack names and long IDs to deconflict multiple objects with the same names. on saveStackLocation pTargetStack put the stackloc of pTargetStack into aStackLoc put line (the screen of stack pTargetStack) of the screenRects into tScreenRect put item 3 of tScreenRect - item 1 of tScreenRect into item 1 of tRect put item 4 of tScreenRect - item 2 of tScreenRect into item 2 of tRect put the loc of pTargetStack into aStackLoc [tRect] set the stackloc of pTargetStack to aStackLoc end saveStackLocation function getStackLocation pTargetStack put the stackloc of pTargetStack into aStackLoc put line (the screen of stack pTargetStack) of the screenRects into tScreenRect put item 3 of tScreenRect - item 1 of tScreenRect into item 1 of tRect put item 4 of tScreenRect - item 2 of tScreenRect into item 2 of tRect return aStackLoc [tRect] end getStackLocation So on closeStack call this function and on openStack call getStackLocation() and set the location of the stack. The reason for the math on the screen rect is because in a multi-monitor setup, the screenRects left for monitors to the right of another do NOT have 0,0 as the leftTop, but rather the left of the RIGHT monitor is the right of the LEFT monitor. I suppose it made sense to the developer at the time. Bob S _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode