frm.MdiParent = this; returns null for MdiParent...

2 posts, 0 answers
  1. Ioannis Papasavvas
    Ioannis Papasavvas avatar
    1 posts
    Member since:
    Oct 2009

    Posted 18 Mar 2010 Link to this post

    Hi folks.

    I use a RadRibbonForm as my main form (MDI container) and also a RadDock control to host my MDI child forms. My main form's Load event follows:

            private void MainForm_Load (object sender, EventArgs e)  
            {  
                if (this.IsMdiContainer != true)  
                    this.IsMdiContainer = true;  
     
                string theme = ThemeResolutionService.ApplicationThemeName;  
                ThemeResolutionService.ApplicationThemeName = "Office2007Silver";  
     
                this.Text = Properties.Resources.AppName;  
     
                this.dock.AutoDetectMdiChildren = true;  
                this.dock.DocumentManager.DocumentInsertOrder = DockWindowInsertOrder.ToBack;  
                this.MdiChildActivate += new EventHandler (MainForm_MdiChildActivate);  
     
                FormPosition.LoadFromRegistry (this, Properties.Resources.AppName);  
            }  
     

    The code that creates a new child form follows:

                EditorForm frm = new EditorForm (file);  
                frm.MdiParent = this;  
                RichTextBoxEx txt = frm.Editor;  
                txt.CursorPositionChanged += new System.EventHandler (CursorPositionChanged);  
                txt.SelectionChanged += new System.EventHandler (SelectionChanged);  
                txt.MouseDown += new MouseEventHandler (OnRichTextBox_MouseDown);  
                frm.Show ();  
     

    The problem is that after the line: "frm.MdiParent = this;" (this is the main form and is not null) frm.MdiParent becomes null !!!

    Can you please help me?

    Thank you in advance.
  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 23 Mar 2010 Link to this post

    Hello Ioannis Papasavvas,

    Thank you for the question.

    RadDock detects when a form is up to become an MDI child and takes it from the original MDIParent. Then, this form is hosted in a RadDock window. When these actions take place, the MDI relation is broken and the form is not a real MDI child anymore, so the MDIParent property becomes null. This is an expected and desired behavior.

    Kind regards,
    Nikolay
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top