This is a migrated thread and some comments may be shown as answers.

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

1 Answer 256 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Ioannis Papasavvas
Top achievements
Rank 1
Ioannis Papasavvas asked on 18 Mar 2010, 12:38 PM
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.

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 23 Mar 2010, 05:38 PM
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.
Tags
Dock
Asked by
Ioannis Papasavvas
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or