Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Obtaining Dimensions of the Client Area
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Obtaining Dimensions of the Client Area

 Post Reply Post Reply
Author
Message
Eugene View Drop Down
Newbie
Newbie


Joined: 30 December 2005
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Eugene Quote  Post ReplyReply Direct Link To This Post Topic: Obtaining Dimensions of the Client Area
    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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Eugene View Drop Down
Newbie
Newbie


Joined: 30 December 2005
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Eugene Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2006 at 12:55am

Hello,

Have no any problems with it:

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
Back to Top
Eugene View Drop Down
Newbie
Newbie


Joined: 30 December 2005
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Eugene Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2006 at 9:58am
Excellent. Thank you very much for the help!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.