MDI Windows

Topics: CAB & Smart Client Software Factory
Sep 22, 2005 at 10:14 AM
originally posted by: Xasp

Hi again,

Until now I've been working with the DeckWorkSpace, which worked just fine. But now I' ve refactored my app. to use a MDIWorkSpace instead.

I bumped into a couple of problems, which I solved as follows:
a) I don't know how to call the constructor of MdiWorkSpace when using Create<> (is that altogether possible? I thought not), so I added to the MdiWorkSpace class a SetParentForm-method which I call right after I add the workspace to the default workitem:
/// <summary>Constructor.</summary>
/// <param name="parentForm"></param>
public MdiWorkspace(Form parentForm)
: base()
{
SetParentForm(parentForm);
}

#endregion

/// <summary>XASP ADDITION: Set the parent form.</summary>
/// <param name="parentForm"></param>
public void SetParentForm(Form parentForm)
{
this.parentMdiForm = parentForm;
this.parentMdiForm.IsMdiContainer = true;
}

b) the window sizing wasn't correct, which could be solved by moving the CalculateSize a few lines up (note also the Control.Dock that was added, cfr. previous message) in the CreateForm-method of WindowWorkSpace:
form = new WindowForm();

CalculateSize(control, form); // XASP move

this.windowDictionary.Add(control, form);
control.Dock = DockStyle.Fill; // XASP Addition
form.Controls.Add(control);

Will these problems be addressed in the coming-up release of CAB ?
Also: may I suggest to add a WindowState and StartPosition-propery to the WindowSmartPart-info object?