Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

finding client area in a form

Status
Not open for further replies.

LindaRichard

Programmer
Feb 23, 2001
103
CA
Hi

In my program I want to position 3 forms in my main vfp window

*first I maximize the screen
_SCREEN.windowstate=2
.. do some other code
*make it visible
_SCREEN.visible=.t.
*load the menu bar
do mainmenu.mpr
*display the top main toolbar
goMainTB.show
*display a toolbar to the left
goGraphicsTB.show

Now I want to position 3 forms so that they fill the
remaining area no matter what the screen resolution.
This is what the layout looks like now

xxxxxxxxxxxxxxxxxx = Title
MMMMMMMMMMMMMMMMMM = Menu
TTTTTTTTTTTTTTTTTT = Top Toolbar
L |
L |
L |
L |
------------------
L=To the left if a tool bar

I want to place 3 forms so that they completly occupy
the remaining space
xxxxxxxxxxxxxxxxxx = Title
MMMMMMMMMMMMMMMMMM = Menu
TTTTTTTTTTTTTTTTTT = Top Toolbar
L1111111222222222|
L1111111222222222|
L1111111222222222|
L3333333333333333|
------------------
L=To the left if a tool bar
1,2, and 3 are the areas to be covered by each form

I have tried playing with
SYSMETRICS(1) and (2) and tracking width and heigth
top and left of the toolbars without success. I am
hoping that there is an easier way of doing this.

I essentialy need to know the width, heigth, top and
left of the remaining area so that I can position my
forms. Anyone have any suggestions?

Thanks
Linda

 
I don't understand the part about "to the left if a toolbar" and I am assuming that the pipes running down the center mean that you are splitting the _screen in half, and I am assuming from your diagram that form3.height will equal 25% of the total height available while leaving 75% for form1 and form2 but anyways:

nTotalHeightAvailable = _screen.height - goMainTB.height
***Note that the height of the _screen already takes into account the title bar and the menu.

nTotalWidthAvailable = _screen.width - goGraphicsTB.width
**Note _screen object already discounts for the borders

form1.width = nTotalWidthAvailable/2
form1.height = nTotalHeightAvailable * .75
form1.top = goMainTB.height
form1.left = goGraphicsTB.width

form2.width = form1.width
form2.height = form1.height
form2.top = goMainTB.height
form2.left = goGraphicsTB.width + form1.width


form3.width = nTotalWidthAvailable
form3.height = nTotalHeightAvailable - form1.height
form3.top = goMainTB.height + form1.height
form3.left = goGraphicsTB.width

***I haven't tested this, and I may have made a mistake or two in my haste, but it should get you close if not right on

**A few things that are not taken into consideration are whether the user can resize the _screen and if they change resolutions while running the application, a hook into the _screen.resize event would have to be done, or bindevents if you are running VFP 8.
Slighthaze = NULL
 
slighthaze,

Thanks for your reply. It didn't quite work, but it put me on the right track. It turns out that _screen.width and
_screen.heigth do return the client area. The only correction that I had to apply was to add 3 pixels per window border drawn. It's a bit of a fudged correction but it seems to work.

Thanks again
Linda

*diagram form
form1.width = _screen.width*.65
form1.height = _screen.height*.93
form1.top = 0
form1.left =0
form1.visible=.t.
*data form
form2.width = _screen.width*.35-12
form2.height = form1.height
form2.top = 0
form2.left = form1.width+6
form2.visible=.t.
*list of forms
form3.width =form1.width+form2.width+6
form3.height =_screen.height-form2.height-12
form3.top =form1.height+6
form3.left =0
form3.visible=.t.
 
Well it got you close then, your happy i'm happy, thanks for the reply back and glad all is working now (fudge or no fudge) :) Slighthaze = NULL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top