Print Page | Close Window

Position Dockingpane with CommandBar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=479
Printed Date: 21 November 2024 at 9:26am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Position Dockingpane with CommandBar
Posted By: Bjarne
Subject: Position Dockingpane with CommandBar
Date Posted: 28 February 2004 at 12:10pm

Hello,

I hope some out there can give me a short example on how to position a DockingPane when there is also a CommandBar with toolbars on an SDI form.

I want to show the dockingpane aligned to the right, but the Top property must be just below the Commandbar Toolbar (Just like Word 2003). I have tried different combinations of the Resize_events and GetclientRect Events, and for some reason the Dockingpane will not stay below the Toolbar. When I resize the form I can see that it moves below, but as soon as I let go of the mouse it moves all the way to the top of the form again.

So a short sample on what commands to put where would be appreciated

Bjarne




Replies:
Posted By: SuperMario
Date Posted: 28 February 2004 at 1:37pm
The correct solution is in my next post below.


Posted By: Bjarne
Date Posted: 28 February 2004 at 2:09pm

Hello SuperMario,

Yes this what what I meant. And I did do what you described above, but for some odd reason it does not work on my form. When I resize the Form by dragging its borders, I can see that the DockingPane moves to the correct top position, but as soon as I let go it moves back to 0.

On a form with a CommandBar and DockingPane, you have 3 Resize Events, where do you put your code to resize everything on the form?

On this form, I put it on the Form_Resize and then I call that procedure from the CommandBar and DockingPane Resize_Event. Is that wrong?

Bjarne



Posted By: SuperMario
Date Posted: 28 February 2004 at 2:46pm
I'm sorry bjarne, not sure what I was thinking at the time.  All you need to do is add this line of code in the Form_Load after your command bars and docking panes are created and attached.

DockingPaneManager.SetCommandBars Me.CommandBars

Here is what is says in the help file:
"If you use both DockingPanes and CommandBars in the same form, associate the command bars with the docking pane manager using this property. This is necessary for correct resizing and layout of controls on the form."

This will fix your problem.  I was trying to do this the hard way.


Posted By: Bjarne
Date Posted: 29 February 2004 at 6:06am

Hi again SuperMario,

I just tried your suggestion, but it does not have any effect what so ever. The DockinPane behaves exactly as before, NOT setting the right Top for the Control.

If I use DockTopOf instead of DockRightOf the dockPane is placed at the top of the Form above the CommandBar. It seems like the DockPane always takes priority over the CommandBar, even though I load the CommandBar first. I am really puzzled about what to do, in what order

Bjarne



Posted By: Bjarne
Date Posted: 29 February 2004 at 6:15am

Found the Solution

I found a solution to the problem. It is the ZOrder that determines what takes priority. Right clikking on the CommandBar and choosing 'Bring to Front' solved the problem. Now it works as expected.

Not sure if this is a bug, but at least it should be mentioned in the Documentation.

Thanks again for your help SuperMario

Bjarne



Posted By: SuperMario
Date Posted: 29 February 2004 at 11:37am
I see what you mean, I sent the CommandBar to the back and my docking panes were docked above the CommandBar.  But you should still need that line of code I posted above when using CommandBar and DockingPane in the same application.  Take it out and you will see what I mean.  I wasn't aware of the ZOrder problem, this sounds like a bug to me.  When you take that line out your docking pane should be docked under the CommandBar, this is what I thought you were talking about.


Posted By: Bjarne
Date Posted: 29 February 2004 at 12:29pm

No you where absolutely right. Without the DockingPaneManager.SetCommandBars Me.CommandBars this will not work, but if the ZOrder is not right, it does not work no matter what you do.

So if I set the above one line command, AND get the ZOrder right it works.

Thanks again,

Bjarne



Posted By: SuperMario
Date Posted: 29 February 2004 at 12:51pm
Is sounds like a ZOrder method needs to be added to the CommandBars, DockingPanes, and PropertyGrid controls.  I have been searching through the help and haven't sounds anyting like this so far.



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