The "screenRects" (plural) is a list of the rects of all the screens currently attached to your computer. "Line 2 of the screenRects" will be empty unless you have multiple screens. Each line in the screenRects is a series of 4 integers, separated by commas, and each line describes the rect of each screen.
If you have only one screen, or you only want to retrieve the rect of the primary screen, use "screenRect" (singular).
Whether singular, or one line of the plural, you will find the screenRect described by 4 integers, the left, top, right and bottom. So you can't take (for instance)0,0,1024,768 and subtract 300.
You could define the rect of the docked stack by something like:
Code: Select all
-- get the screenRect and stuff it in a variable we can use
put the screenRect into tRect
--get item 3 of our variable, which will be the right, subtract 300
--and put the new value into item 1 of our variable, which will be the left
put item 3 of tRect - 300 into item 1 of tRect
--redefine the "rectangle" area covered by this stack to be the
--coordinates for left, top, right and bottom held in our variable
set the rect of this stack to tRect
which should give you a stack 300 px wide positioned at the right of the screen, and taking the full height of the screen. You dont' have to use "rect" (or "rectangle") to define the shape and position properties of your stack. The "rect" defines the area covered by an object. Implicitly then you know that if you were to check the width property for the object, it would return the difference between the 1st and 3rd items of the rect. You can also set the width and height of an object. This would then reciprocally affect the rect. Setting the right (or left, or top or bottom) property of an object won't change its size, but it will change its rect as it is repositioned, but the difference between the 1st and 3rd, or between the 2nd and 4th items of its rect won't change when you set its new position. You could also do something like
Code: Select all
set the width of this stack to 300
set the height of this stack to item 4 of the screenrect - item 2 of the screenrect
set the right of this stack to item 3 of the screenrect
set the top of this stack to 0
Hopefully it is a little clearer now to see that you can take any one of the properties and adjust it. If you affect a "rect" then you can take any one item in the list of properties that define it to adjust.
I hope that's made things easier to get the hang of, rather than confuse. If I've messed up explaining, please ask.