How to make a pane docking by default |
Post Reply |
Author | |
zwdhm
Newbie Joined: 26 October 2004 Status: Offline Points: 26 |
Post Options
Thanks(0)
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? |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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 |
|
zwdhm
Newbie Joined: 26 October 2004 Status: Offline Points: 26 |
Post Options
Thanks(0)
|
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? |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
What problem are you referring to?
|
|
zwdhm
Newbie Joined: 26 October 2004 Status: Offline Points: 26 |
Post Options
Thanks(0)
|
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. |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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 |
|
zwdhm
Newbie Joined: 26 October 2004 Status: Offline Points: 26 |
Post Options
Thanks(0)
|
Ok, the program works well now. Thank you! |
|
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 |