docking pane border |
Post Reply |
Author | |
johnp
Groupie Joined: 21 February 2008 Status: Offline Points: 49 |
Post Options
Thanks(0)
Posted: 22 February 2008 at 10:42am |
I have a vb6 sdi for that has a commandbar and (standard windows) status bar. I am creating docking panes at run-time based on the user's clicking items from a treeview control. The panels are being created okay but there is a small problem... when a panel is initially displayed (docked right of) the height of the panel extends so that the bottom portion of the panel is behind the status bar (i.e., I cannot see the frame on the bottom of the panel). Howeverm when I hide and redisplay the panel the height is set so that the bottom frame shows (i.e., it does not extend below the status bar). What can I do to correct this so that when the panel is first shown it does not drop down below the status bar? |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Be sure you are doing this:
http://codejock.com/support/articles/com/dockingpane/dp_3.asp And try using CommandBars Resize event. |
|
johnp
Groupie Joined: 21 February 2008 Status: Offline Points: 49 |
Post Options
Thanks(0)
|
Thanks for the reply. My problem is not with the docking pane and the command bar (that's working just fine). It is with the docking pane and the statusbar at the bottom of the form. When i first create the panel and show it the panel is too long for the form and the bottom portion of the panel is hidden behind the status bar. if i hide (unpin) the panel and then click it's tab the panel is properly sized (hieght wise) between my command bar and the status bars
|
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Maybe try:
Private Sub CommandBars_GetClientBordersWidth(Left As Long, Top As Long, Right As Long, Bottom As Long) If sbStatusBar.Visible Then Bottom = sbStatusBar.Height End If End Sub |
|
johnp
Groupie Joined: 21 February 2008 Status: Offline Points: 49 |
Post Options
Thanks(0)
|
Yes, I have that in my code. As I said, the panel shows at the proper size once it has been hidden and redisplayed. I can't think of any code that I've written that would affect this behavior.
|
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Can you attach a small sample?
|
|
johnp
Groupie Joined: 21 February 2008 Status: Offline Points: 49 |
Post Options
Thanks(0)
|
Sorry, how do I attach my sample |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
you have to hit the reply button or the option won't show up.
|
|
johnp
Groupie Joined: 21 February 2008 Status: Offline Points: 49 |
Post Options
Thanks(0)
|
Thanks. I created a small project to try and show the problems I am having. You will set that the main show two panels when it is first loaded. These panels are docked to the bottom of the form. The problem is (I posted a question about this yesterday) is that no matter what I try I cannot get the width of these panels such that the left-hand side of each panel ends at the tree view control... thus, I cannot see the panel captions.
The second issue that I thought I was having (and which is the subject of this post) was that if you click Panel A in the tree view control a panel appears docked to the right side of the main form. I have since determined that the black border around the form in this panel is the result of having a hidden menu on the form. However, in this sample project, the height of the panel is correct both when it is intially displayed and hidden/unhidden. I guess I must have something different in my 'real' project - which is too large to send - that is causing the problem I am having
|
|
johnp
Groupie Joined: 21 February 2008 Status: Offline Points: 49 |
Post Options
Thanks(0)
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
Think maybe this is what you want?
Private Sub CommandBars_Resize() On Error Resume Next Dim Left As Long Dim Top As Long Dim Right As Long Dim Bottom As Long CommandBars.GetClientRect Left, Top, Right, Bottom If Right >= Left And Bottom >= Top Then TreeView1.Move Left, Top, Right - Left, Bottom - Top Else TreeView1.Move 0, 0, 0, 0 End If End Sub |
|
johnp
Groupie Joined: 21 February 2008 Status: Offline Points: 49 |
Post Options
Thanks(0)
|
After adding your code, my treeview control is now at the top of my form (under the command bar) and spans the entire width of the form.
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
When using commandbars with dockingpanes, commandbars will handle all resizing events for you. (DockingPane.SetCommandBars Me.CommandBars)
also the ResizeClient event.
so you could determine what space you have left for the treeview like this:
Private Sub CommandBars_ResizeClient(ByVal Left As Long, ByVal Top As Long, ByVal Right As Long, ByVal Bottom As Long)
If StatusBar1.Visible Then Bottom = StatusBar1.Top
TreeView1.Move Left, Top, Right - Left, Bottom - Top End Sub
Docking the panes at startup:
I haven't found a way to lock the client area on a certain position, maybe it's possible, maybe not. So, docking the panes to the right side of the form will position the client area on the left side. If you want the second pane below the first one you can use the last param to dock that pane as neighbour:
Dim Pane
Set Pane = DockingPane.CreatePane(1, 400, 200, DockRightOf, Nothing)
Dim Pane2 As Pane
Set Pane2 = DockingPane.CreatePane(2, 400, 200, DockBottomOf, Pane) ''Pane is the pane you already created I would use the statusbar of commandbars so you don't have to deal with size and position etc. when dragging toolbars to the bottom of the form. Test this and you will see what I mean.
|
|
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 |