Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Docking Pane
  New Posts New Posts RSS Feed - DockingPane - NullReferenceException
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

DockingPane - NullReferenceException

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


Joined: 10 June 2009
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote modwyer8 Quote  Post ReplyReply Direct Link To This Post Topic: DockingPane - NullReferenceException
    Posted: 03 June 2010 at 11:45am
Hi-

I found another post with this problem that has no resolution.  http://forum.codejock.com/forum_posts.asp?TID=16179

I followed the SDISample.PDF tutorial and created a form that had docking panes on it.  It worked great.  I then followed the same steps and added it as a form to my application.  Every time I try to launch the form with the docking panes on it I get the error:
System.NullReferenceException was unhandled by user code
  Message="Object reference not set to an instance of an object."

on the line where I set the .Title of the first pane:
paneA.Title = "Pane A";
   
I don't understand why this works as a separate app but not as a form.   I even went so far as to add in the DockingPane example provided by CodeJock as a form in my application.  I get the same error with that.  I didn't modify the code at all.  It is the exact sample that CodeJock provides which works on its own.

Does the docking pane work when it is a form in an application or must it be only used in the main form of a standalone app? 

Does anyone have any suggestions?

It appears that .CreatePane is not creating a pane.

Thank you for your help.


StackTrace:
       at MDI_Test.frmCalendar.frmCalendar_Load(Object sender, EventArgs e) in C:\MailManager\Copy of Tester_MDI_Test\MDI_Test\frmCalendar.cs:line 743
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.Show()
       at MDI_Test.ECFMail.tsBtnCal2_Click(Object sender, EventArgs e) in C:\MailManager\Copy of Tester_MDI_Test\MDI_Test\ECFMail.cs:line 4001
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Product: Xtreme SuitePro ActiveX 2009 (13.0.0)
Platform: Windows XP (32bit) - SP 3
Language: C#, VS2005
Back to Top
modwyer8 View Drop Down
Newbie
Newbie


Joined: 10 June 2009
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote modwyer8 Quote  Post ReplyReply Direct Link To This Post Posted: 03 June 2010 at 12:39pm
It seems that I get the NullReferenceException error when I set the MDIParent of the form that contains the DockingPanes.  If I remove that line then the form launches fine.

Now the question is, can the docking panes NOT be used on a child form in an MDI app?
Product: Xtreme SuitePro ActiveX 2009 (13.0.0)
Platform: Windows XP (32bit) - SP 3
Language: C#, VS2005
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: 04 June 2010 at 1:12pm
Please see the MDI Docking C# or VB.Net sample, it shows how to add DP in MDI Child and as normal form.

"C:\Program Files\Codejock Software\ActiveX\Xtreme SuitePro ActiveX v13.4.0\Samples\Common\VB.NET\MDIDocking\MDIDocking.sln"
Back to Top
modwyer8 View Drop Down
Newbie
Newbie


Joined: 10 June 2009
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote modwyer8 Quote  Post ReplyReply Direct Link To This Post Posted: 04 June 2010 at 4:15pm
Thank you for the reply.  I thought of looking at that example as I was falling asleep last night.  I should have thought of that sooner.

Sorry if this post turns out to be a bit long. 

I have it working to where the form with the docking panes opens as a child of the MDIContainer (which itself does not have a docking pane manager) but the events I set up for the DockingPaneManager are not getting fired off when I create the Pane Objects.  (.GetClientBordersWidth, .AttachPaneEvent...) 

I no longer get the NullReferenceException error and some lines of debug code I put in after creating the Panes show they are not null.  But when my form opens the calendar object (the client part of the DockingPaneManager) is the same size (small) as it is in Design view and there are no panes.

I am pretty sure this is because the events for the DockingPaneManager are not getting hit. 

Are the main differences between the SDI and MDI examples that the MDI example has the "foreach (Control ctrl in this.Controls)..." loop in frmMain that calls SetMDIClient, for a form set to be an MDIContainer - and then putting the initialization of the DockingPaneManager control in the Load of the form with Docking Panes that is to be the child form, as in frmDocument?

Is there something else I am missing?

Again, thanks for the help.

Here is the Load of my child form:
private void frmCalendar_Load(object sender, EventArgs e)
        {
            //
            // DockingPaneManager
            //

            this.DockingPaneManager = new AxXtremeDockingPane.AxDockingPane();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmCalendar));
            ((System.ComponentModel.ISupportInitialize)(this.DockingPaneManager)).BeginInit();
            this.DockingPaneManager.Enabled = true;
            this.DockingPaneManager.Location = new System.Drawing.Point(58, 233);
            this.DockingPaneManager.Name = "DockingPaneManager";
            this.DockingPaneManager.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("DockingPaneManager.OcxState")));
            this.DockingPaneManager.Size = new System.Drawing.Size(24, 24);
            this.DockingPaneManager.TabIndex = 16;
            this.DockingPaneManager.ResizeEvent += new System.EventHandler(this.DockingPaneManager_ResizeEvent);
            this.DockingPaneManager.AttachPaneEvent += new AxXtremeDockingPane._DDockingPaneEvents_AttachPaneEventHandler(this.DockingPaneManager_AttachPaneEvent);
            this.DockingPaneManager.GetClientBordersWidth += new AxXtremeDockingPane._DDockingPaneEvents_GetClientBordersWidthEventHandler(this.DockingPaneManager_GetClientBordersWidth);
            this.DockingPaneManager.Action += new AxXtremeDockingPane._DDockingPaneEvents_ActionEventHandler(this.DockingPaneManager_Action);

            this.Controls.Add(this.DockingPaneManager);
            ((System.ComponentModel.ISupportInitialize)(this.DockingPaneManager)).EndInit();

            DockingPaneManager.ScaleMode = XtremeDockingPane.XTPScaleMode.xtpScalePixel;

            // create side tabbed panes
            CreatePaneObjects();
}

Here is  CreatePaneObjects():

private void CreatePaneObjects()
        {
            //Determine if Alpha Context is supported, if it is, then enable it
            //Determine if Docking Stickers is supported, if they are, then enable them
            if (Environment.OSVersion.Version.Major >= 5)
            {
                DockingPaneManager.Options.AlphaDockingContext = true;
                DockingPaneManager.Options.ShowDockingContextStickers = true;
            }
            else
            {
                DockingPaneManager.Options.AlphaDockingContext = false;
                DockingPaneManager.Options.ShowDockingContextStickers = false;
            }
          
            DockingPaneManager.Options.ShowCaptionMaximizeButton = true;

            Pane curMo = DockingPaneManager.CreatePane(0, 207, 159, XtremeDockingPane.DockingDirection.DockLeftOf, null);
            curMo.Title = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(DateTime.Now.Month);
            curMo.MinTrackSize.SetSize(201, 153);
            curMo.MaxTrackSize.SetSize(210, 159);
               
            DockingPaneManager.Options.ThemedFloatingFrames = true;
}  
Product: Xtreme SuitePro ActiveX 2009 (13.0.0)
Platform: Windows XP (32bit) - SP 3
Language: C#, VS2005
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.203 seconds.