Nevron Forum

How close NUIDocument

https://www.nevron.com/Forum/Topic3019.aspx

By Pavel Kozak - Thursday, February 4, 2010


I use the tabs on NUIDocument to display various elements on the meringue and WinForm UserControl as follows:

private static NUIDocument ShowDoc(Form DocForm, string Title, string Key, int Index)
{
DocForm.TopLevel = false;
DocForm.FormBorderStyle = FormBorderStyle.None;
DocForm.ShowIcon = false;
DocForm.ShowInTaskbar = false;
DocForm.Dock = DockStyle.Fill;
DocForm.Show();

NUIDocument doc = new Nevron.UI.WinForm.Controls.NUIDocument();
doc.Client = DocForm;
doc.Text = title;
doc.Key = Key;
doc.ImageIndex = Index;

DockMng.DocumentManager.AddDocument(doc);
return doc;
}

This works fine, help with:

1. Is this correct?
2. As with inside DocForm (Form) with reference to the parent NUIDocument properly close a tab that we have created.
By Angel Chorbadzhiev - Thursday, February 4, 2010

Hello Pavel,

Better solution is instead of using Form to use a Panel. It is more lightweight and you don't have to worry about it when close the NUIDocument.

Regards,

By Pavel Kozak - Thursday, February 4, 2010

This decision was also, but the Form and UserControl like so that they can design in the designer.
If I do not got it wrong, then the problem remains the same.

My task - to place on the Form or Panel button with the action of "Close", which should properly close NUIDocument which is this component!
As an interim, I call the "NUIDocument". Host.Destroy () and the tab is closed, but it is barbarism, and as I understand the consequences.
As with reference to NUIDocument properly close it, ie as gross pressed the "cross" in the row of tabs with titles of documents.

Pavel.
By Angel Chorbadzhiev - Thursday, February 4, 2010

Hi Pavel,

If I understand correctly you want to close NUIDocument by let say pressing a button that resides in it.

If is so try to do the following:

nDockManager1.DocumentManager.CloseActiveDocument();

Regards,

Angel.

By Pavel Kozak - Thursday, February 18, 2010

Thanks, it works fine.

But I have now the task a little more complicated. There are events in the system, which should close all the tabs with specific content. And in this case CloseActiveDocument no longer valid, I have a handler of this event is a reference to DocumentManager NUDocuments and those who want to close, as you can perform this operation?
By Angel Chorbadzhiev - Thursday, February 18, 2010

Hi Pavel,

In this case you can remove the desired documents by calling RemoveDocument method of the document manager for each of them:

nDockManager1.DocumentManager.RemoveDocument(myDoc);

Regards,

Angel.