DockingPaneManager_Action |
Post Reply |
Author | |
tomamoss
Newbie Joined: 19 December 2006 Status: Offline Points: 12 |
Post Options
Thanks(0)
Posted: 12 January 2007 at 5:08am |
Hi If I put a picturebox into a pane ie Item.Handle = Picture1.hwnd in the event DockingPaneManager_AttachPane Then add a form into another pane, which has a public sub procedure that displays a msgbox. If you call that procedure from DockingPaneManager_Action while moving focus from the form to the pane with picture box the app will crash. my question is do you have to treat picture boxes different than form? Thanks for your help
Tom
|
|
tomamoss
Newbie Joined: 19 December 2006 Status: Offline Points: 12 |
Post Options
Thanks(0)
|
Sorry to be a pain But in my desperate attempt to get a fix I took the SDISample sample and just added a sub Public Sub msg() MsgBox "test" End Sub in the form frmPane in the DockingPaneManager_Action event I use this If Action = PaneActionDeactivated Then If Pane.Title = "Pane 7" Then arrPanes(6).msg End If End If Once this is called the msgbox will show, and once you click OK it will crash. I really could do with some help with this Cheers |
|
LittleJK
Senior Member Joined: 13 April 2006 Status: Offline Points: 168 |
Post Options
Thanks(0)
|
most of your issue lies with that you are trying to use a form. When attaching the form you should be declaring
Private WithEvents fnewform As newform and then attach fnewform.hwnd either in the attach pane method or if you want to you can use a shortcut of declaring it in the code for the docking pane itself such as: With Me.DockingPaneManager .CreatePane ID_PANE, 241, Int(Me.Height / 15), DockLeftOf With .FindPane(ID_PANE) .Handle = Me.pic_options.HWnd or me.fnewform.hwnd .Options = PaneNoCloseable Or PaneNoDockable .Title = "Pane" End With Also you are trying to pass it as a public sub... you don't need to do that at all with the form... to display a message from the form... you can put a msgbox in the mouse click event of whatever is in the form |
|
tomamoss
Newbie Joined: 19 December 2006 Status: Offline Points: 12 |
Post Options
Thanks(0)
|
Thank you littleJK
All my problems started because I want to verify that a user has filled in all fields on a form. I could check this when the form loses focus. But the form lost focus event does not work with the DockingPane. So I use the Deactivate event. But I can't set the focus back to the form. Code example. Add two picturebox to form named frmMain. Add another form. Form2 Add the following code to frmMain
Option Explicit Private WithEvents frmForm2 As Form
Private Sub Form_Load() Set PanePic1 = DockingPaneManager.CreatePane(1, 1350, 1200, DockTopOf) PanePic1.Title = "Pic1" Set PanePic2 = DockingPaneManager.CreatePane(1, 1350, 1200, DockTopOf) PanePic2.Title = "Pic2" PanePic2.AttachTo PanePic1 Set PaneForm2 = DockingPaneManager.CreatePane(1, 350, 700, DockBottomOf) PaneForm2.Title = "Form2" PanePic1.Handle = Picture1.hWnd PanePic2.Handle = Picture2.hWnd Set frmForm2 = New Form2 PaneForm2.Handle = frmForm2.hWnd DockingPaneManager.VisualTheme = ThemeOffice2003 DockingPaneManager.TabPaintManager.Position = xtpTabPositionTop DockingPaneManager.Options.HideClient = True End Sub Private Sub Form_Unload(Cancel As Integer) Unload frmForm2 Set frmForm2 = Nothing End Sub Private Sub frmForm2_Deactivate() 'check that all fields are filled before they move the focus from this form. MsgBox "Please fill all manditory fields on form." frmForm2.SetFocus End Sub You will see that we are in a endless loop. Thanks for all your help. Cheers Tom |
|
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 |