Print Page | Close Window

How to make a pane docking by default

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=1321
Printed Date: 13 May 2024 at 9:48pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to make a pane docking by default
Posted By: zwdhm
Subject: How to make a pane docking by default
Date Posted: 26 October 2004 at 8:10am

I want to make a pane docking by default when form was loaded.

If the pane is hided and has not been shown at least once since main form was loaded, an runtime error will occur when I operate controls on the pane.

Does somebody know how to do?




Replies:
Posted By: SuperMario
Date Posted: 26 October 2004 at 8:24am
Here is how to hide a pane.  Be sure that you hide the pane only after you are done refrencing it with other CreatePane calls.  In the example below, Pane B is docked on top of Pane A, Pane A is referenced in Pane B's CreatePane call, so you must wait to hide Pane A until Pane B was created.

    Dim A As Pane, B As Pane
    
    Set A = DockingPaneManager.CreatePane(1, 200, 120, DockLeftOf)
    A.Title = "Pane A"
   
    Set B = DockingPaneManager.CreatePane(2, 200, 120, DockTopOf, A)
    B.Title = "Pane B"

    A.Hide

If you are working with a pane that has not been shown I might just create a new instance of each form that is attached to your panes in the Form_Load event you can then work with this instance before the pane is even shown.  Then you can attach the form you created in the Load_Form event when the Pane fires the Attach_Pane event.  So you wouldn't be creating the new instance of a form in the Attach_Pane event, you only attached the forms you already created when the app first started. 

Hope this help/made sense


Posted By: zwdhm
Date Posted: 27 October 2004 at 6:11am

If the state of PaneA was hide when the program colsed last time(SaveState method was used), and this time I use LoadState methode, how to solve the problem? 



Posted By: SuperMario
Date Posted: 27 October 2004 at 8:14am
What problem are you referring to?


Posted By: zwdhm
Date Posted: 28 October 2004 at 1:39am

The problem is the same as above.

If the pane is hided and has not been shown at least once since main form was loaded, and the state of PaneA was hide when the program colsed last time(SaveState method was used), and this time I use LoadState method. The pane is hide by defaultan runtime error will occur when I operate controls on the pane.



Posted By: SuperMario
Date Posted: 28 October 2004 at 7:06am
Thats because the form/controls has not yet been attached to the pane.  In my previous post I mentioned that you should create a new instance of the forms you will attach to the pane.  You then work with the new form when accessing controls.  When the attach_pane event is fired, you simply test when pane triggered the evant and attache the appropriate form.

'Placed in Genaral code section (frmMyControls is my form)
    Const PANE_1 = 100
    Dim frmMyControls As frmMyControls

'In Form_Load
    Set frmMyControls = New frmMyControls
   
    'Here you can work with the form and controls on the form before the docking pane is ever created.

    Dim A As Pane
   
    Set A = DockingPaneManager.CreatePane(PANE_1, 200, 120, DockLeftOf, Nothing)
    A.Tag = PANE_1
    A.Hide

'In Attach_Pane event
    If Item.Tag = PANE_1 Then
        Item.Handle = frmMyControls.hWnd
    ElseIf Item.Tag = PANE_2 Then
        Item.Handle = form2.hWnd
    Else
        Item.Handle = form3.hWnd
    End If



Posted By: zwdhm
Date Posted: 29 October 2004 at 3:14am

Ok, the program works well now.

Thank you!




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