Posted 19 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:Code to determine whether or not the active Window can be used to show the details (triggered when user double clicks treeview leaf
Any ideas? I'm using VS 2003, with the latest UIStudio release 1.5.0041.
Thanks,
Kevin
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);
dw.Activate();
// Attach the form to the window
dw.Controls.Add(f);
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 ...
}
Thanks,
Kevin