Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Docking Pane
  New Posts New Posts RSS Feed - How to make a pane docking  by default
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to make a pane docking by default

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


Joined: 26 October 2004
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote zwdhm Quote  Post ReplyReply Direct Link To This Post Topic: How to make a pane docking by default
    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?

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zwdhm View Drop Down
Newbie
Newbie


Joined: 26 October 2004
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote zwdhm Quote  Post ReplyReply Direct Link To This Post 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? 

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 27 October 2004 at 8:14am
What problem are you referring to?
Back to Top
zwdhm View Drop Down
Newbie
Newbie


Joined: 26 October 2004
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote zwdhm Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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



Edited by SuperMario
Back to Top
zwdhm View Drop Down
Newbie
Newbie


Joined: 26 October 2004
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote zwdhm Quote  Post ReplyReply Direct Link To This Post Posted: 29 October 2004 at 3:14am

Ok, the program works well now.

Thank you!

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.219 seconds.