Position Dockingpane with CommandBar |
Post Reply |
Author | |
Bjarne
Newbie Joined: 30 December 2003 Location: Denmark Status: Offline Points: 28 |
Post Options
Thanks(0)
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 |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
The correct solution is in my next post below.
Edited by SuperMario |
|
Bjarne
Newbie Joined: 30 December 2003 Location: Denmark Status: Offline Points: 28 |
Post Options
Thanks(0)
|
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 |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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. Edited by SuperMario |
|
Bjarne
Newbie Joined: 30 December 2003 Location: Denmark Status: Offline Points: 28 |
Post Options
Thanks(0)
|
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 |
|
Bjarne
Newbie Joined: 30 December 2003 Location: Denmark Status: Offline Points: 28 |
Post Options
Thanks(0)
|
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 |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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.
Edited by SuperMario |
|
Bjarne
Newbie Joined: 30 December 2003 Location: Denmark Status: Offline Points: 28 |
Post Options
Thanks(0)
|
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 |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |