Profile Picture

Docking NUIDocuments? (code)

Posted By Fábio Mello 14 Years Ago
Author
Message
Fábio Mello
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1
How can I make an initial display of NUIDocuments docked in a similar way to the sample attached?


Attachments
docking.jpg (195 views, 74.00 KB)
Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hello Fábio,

To dock the panels as they are in the attached image, you need to use one of the DocumentManager.AddDocument overloads.

When you first add a NUIDocument to the DocumentManager.Documents collection it initialize an ActiveGroup property which will holds the panels that are added to the Documents collection without specifying the group explicitly.

When you add the rest of the panels you should specify the group they will reside and how they should be docked.

Please, check the code snipped below which shows how you can achieve the desired state of the panels:

NUIDocument doc1 = new NUIDocument("Doc1");
NUIDocument doc2 = new NUIDocument("Doc2");
NUIDocument doc3 = new NUIDocument("Doc3");
NUIDocument doc4 = new NUIDocument("Doc4");

NDocumentManager documentManager = nDockManager1.DocumentManager;
//This will create documentManager.ActiveGroup which we will use below.
documentManager.AddDocument(doc1);

NDocumentHost activeGroup = documentManager.ActiveGroup;
nDockManager1.DocumentManager.AddDocument(doc2, activeGroup,
DockStyle.Fill);
nDockManager1.DocumentManager.AddDocument(doc3, activeGroup,
DockStyle.Right);
nDockManager1.DocumentManager.AddDocument(doc4, activeGroup.RootZone,
DockStyle.Bottom);



Best Regards,
Nevron Support Team



Fábio Mello
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1
Thank you very much.

My problem is solved.

Fábio Mello
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1
One more thing, is there a RightClick event in the NUIDocuments header? (I'd like to expand a dropdown list of general commands by rightclicking the NUIDocument's header like the tab groups in Visual Studio's editor)

Thanks in advance

Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hello Fábio,

I guess you want to display context menu on the NUIDocument when the DocumentViewStyle is MdiTabbed.

There is no event exposed directly, but you can use the following workaround:

NDocumentPanel host = nDockManager1.DocumentManager.ActiveDocument.Host as NDocumentPanel;
if (host != null)
{
    NTabStrip tabStrip = host.Parent.Controls[0] as NTabStrip;
    if (tabStrip != null)
    {
        tabStrip.MouseClick +=
new MouseEventHandler(tabStrip_MouseClick);
    }
}

...

void tabStrip_MouseClick(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Right)
    {
        NDocumentPanel host = nDockManager1.DocumentManager.ActiveDocument.Host as NDocumentPanel;
        if (host != null)
        {
            NTabStrip tabStrip = host.Parent.Controls[0] as NTabStrip;
            if (tabStrip != null)
            {
                NContextMenu menu = new NContextMenu();
                //Add some commands.
                menu.Show(MousePosition);
                //To determine on which tab you have clicked you can use:
                NTab clickedTab = tabStrip.Tabs.TabFromPoint(e.Location);

            }
        }
    }
}



Best Regards,
Nevron Support Team



Fábio Mello
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1
Thank you for the response.

In which assembly is the class NDocumentPanel?
I couldn't find it.

I use Nevron .NET Vision for VS2008.

Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Fabio,

NDocumentPanel is in Nevron.UI.WinForm.Docking assembly.



Best Regards,
Nevron Support Team



Fábio Mello
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 12, Visits: 1
Hi,

This is very strange.
NDocumentPanel is not in my Nevron.UI.WinForm.Docking assembly.

Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Fabio,

You might not see it because it has EditorBrowsableAttribute set to Never.



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic