dock a stack on the screen

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jesse
Posts: 205
Joined: Thu Nov 11, 2010 6:32 pm

dock a stack on the screen

Post by jesse » Thu Jun 23, 2011 9:26 pm

i would like to dock a menu stack on the right side of the screen just like you see a windows taskbar at the bottom of the screen.
how would one attempt doing this?
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: dock a stack on the screen

Post by Klaus » Thu Jun 23, 2011 9:51 pm

Hi jesse,

checking "the screenrect" and using this as reference for
the position (especially "the right"!) of your stack could be helpful :D


Best

Klaus

jesse
Posts: 205
Joined: Thu Nov 11, 2010 6:32 pm

Re: dock a stack on the screen

Post by jesse » Thu Jun 23, 2011 10:17 pm

Klaus,

Thats a helpful start. Thanks. Could you tell me where I might find anymore information for that particular feature.
I'm not understanding how to set the rect of just the height on screenRects, and then position the window all the way to
the left of the screenRects. the documentation example code didn't seem to work at all for me when i plugged it
into a mouseup button code.

Code: Select all

set the rect of this stack to line 2 of the working screenRects
I tried plugging in this code to a button on the stack but it didn't work of course.

Code: Select all

set the rect  of this stack to the screenRect - 300
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: dock a stack on the screen

Post by SparkOut » Fri Jun 24, 2011 12:54 am

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.

jesse
Posts: 205
Joined: Thu Nov 11, 2010 6:32 pm

Re: dock a stack on the screen

Post by jesse » Fri Jun 24, 2011 4:13 am

Thats great! Really helped me to understand it more. Thank you so much!
Deving on WinVista Home Prem. SP2 32 bit. Using LiveCode 4.6.1 Pro Build 1392

Post Reply