Print Page | Close Window

Obtaining Dimensions of the Client Area

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=3460
Printed Date: 06 October 2024 at 2:26am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Obtaining Dimensions of the Client Area
Posted By: Eugene
Subject: Obtaining Dimensions of the Client Area
Date Posted: 03 January 2006 at 10:40am
Hello,

We are developing a VB 6.0 application. We’ve recently purchased a 4-developer license for the Xtreme Pro Suite. We are using Commandbars for the menus, toolbar, status bar, and MDI tabbed workspace.

However, we haven’t been able to figure out how to calculate the full client area available for a given form. We need to know this in order to re-position and re-size the controls to allow the form to work in various resolutions.

We’ve tried the following:

    'Calculate the height and width of the client area.

    Dim lLeft As Long, lTop As Long, lRight As Long, lBottom As Long

    CommandBars.GetClientRect lLeft, lTop, lRight, lBottom

    lClientWidth = lRight - lLeft

    lClientHeight = lBottom – lTop

I’ve then assigned these values to Width and Height within the MDI child form. However, the values returned by GetClientRect are not even remotely correct. I presume that GetClientRect returns the full area from the toolbar (assuming the toolbar is at the top of the screen), to the status bar, and from the left and right sides of the MDI form (assuming no docked items). Is this correct? Is there some other function we should be using? 

When we make a call to GetClientRect, we end up with a width of 4680 and a height of 1725. This is far from the actual client area of about 11,500 by 5,750 (on our test machine).

Note, in case it makes a difference to how GetClientRect does its calculations, within our forms we are using the Sizer tool from ComponentOne (specifically, the C1 Elastic component). This allows us to re-size components and sections of our forms.

In the samples, the MDI child form always seems to have Top, Left, Width, and Height set within Form_Load. The values assigned to Width and Height are always larger than the actual client area (in the samples, they are usually 31,000). These values stop us from being able to properly re-size and re-position controls on the form. What is the purpose behind these values?

I realize that this is a very straightforward task we are trying to accomplish, but we cannot seem to get it to work with Commandbars in use. We’ve searched through the forums and have studied the documentation. We’re lost. The package seems quite good, but the documentation is horrible!

Can anyone offer any suggestions?

Thanks in advance.



Replies:
Posted By: Oleg
Date Posted: 03 January 2006 at 1:53pm

Hello,

CommandBars.GetClientRect doesn't decrease size of MDITabWorkspace.

Think it can be reason of you problem...



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Eugene
Date Posted: 03 January 2006 at 2:19pm
Hello,

I'm not trying to change the size of the MDITabworkspace. I am trying to re-size the MDI child form. In the samples provided with Commandbars, the MDI child form has Top, Left, Width, and Height set from within the Form_Load procedure. In your examples, these values seem arbitrary -- negative numbers are used for Top and Left and huge numbers (31,000) are used for Width and Height. I can't find anything in the documentation explaining why these values were used.

I need to find out how to determine the size of the actual client area -- judging from the help files, that seems like what GetClientRect is supposed to do, but I am not getting proper values. For example, GetClientRect is returning the same values regardless of the resolution of the system.

This is a mission-critical capability for us. If we can't get this addressed, we can't use Xtreme Pro!

Thanks.

Eugene.


Posted By: Oleg
Date Posted: 04 January 2006 at 12:55am

Hello,

Have no any problems with it:

https://forum.codejock.com/uploads/oleg/2006-01-04_005454_ms.zip - 2006-01-04_005454_ms.zip

 

see this code:

    frmD.Show
   
    Dim l As Long, r As Long, t As Long, b As Long
    CommandBars.GetClientRect l, t, r, b
    frmD.Move 0, 0, r - l - 80, b - t - 80



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Eugene
Date Posted: 04 January 2006 at 9:58am
Excellent. Thank you very much for the help!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net