FocusedTabbedMdiWindow is returning the in-focus Tool Window

Docking/MDI for Windows Forms Forum

Posted 18 years ago by Kevin Mackie
My application has multiple Tool Windows and multiple Document windows. When I call FocusedTabbedMdiWindow() I'm getting the Tool window that's in focus and I'm expecting to receive the Document window that's in focus.

The first question is, is my expectation correct? Should I be getting the in-focus Document (MDI) window? If my expectation is correct, then here are the details.

Use Case

In toolWindow1, I have a treeview. When the user double clicks on a leaf, I want to show the details of that selection in a Document. If the active Document is of the proper type, I want to use that active document to show the details. If the active Document is not of the proper type, I want to create a new Document and show the details there.

Document Creation:
// Create the form
ICEBrowserForm f = new ICEBrowserForm(this);
f.Visible = true; 
f.TopLevel = false;
f.FormBorderStyle = FormBorderStyle.None;
f.Dock = DockStyle.Fill;

// Do form specific stuff ...

// Create the doc window
DocumentWindow dw = new DocumentWindow(dm, "Key", "ICE Search", 0, null);

// Attach the form to the window 
Code to determine whether or not the active Window can be used to show the details (triggered when user double clicks treeview leaf
TabbedMdiWindow dw = dm.FocusedTabbedMdiWindow;
try {
    Control c = dw.Controls[0];

    // If this is the correct type of form, the first (and only) control should be the ICEBrowserForm
    ICEBrowserForm f = ((ICEBrowserForm) dw.Controls[0]);

    // Get this form's browser control
    AxWebBrowser wb = f.axWebBrowser1;

    // Use this browser to show details ...
catch {
    // Create a new document window and show details there ...
Any ideas? I'm using VS 2003, with the latest UIStudio release 1.5.0041.


Comments (2)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Kevin,

FocusedTabbedMdiWindow will return the document or tool window that has focus, if any. So it could return either type.

I believe what you want is DockManager.SelectedDocument, which will return the window that current is selected in the MDI area. This generally will be a document window but in instances where the user places a tool window in the MDI area and it is selected, that can be returned by this property.

Actipro Software Support

Posted 18 years ago by Kevin Mackie
That did it. Thank you for the very prompt reply!

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.