ModalWindows Workspace

Topics: CAB & Smart Client Software Factory
Nov 2, 2006 at 12:07 PM
originally posted by: dpadlewski

Im trying to display a view in the ModalWindows workspace

IFindRegionView view = WorkItem.SmartParts.AddNew<FindRegionView>();

The window displays, however not correctly as it seems to lose all the setting specified in the GetSmartPartInfo method:

public ISmartPartInfo GetSmartPartInfo(Type smartPartInfoType) {
ISmartPartInfo spi;
if (smartPartInfoType.IsAssignableFrom(typeof(WindowSmartPartInfo))) {
WindowSmartPartInfo wspi = new WindowSmartPartInfo();
wspi.Modal = true;
wspi.MinimizeBox = false;
wspi.MaximizeBox = false;
wspi.ControlBox = true;
wspi.KeysWindowWorkspaceSetting.FormBorderStyle = FormBorderStyle.FixedDialog;
wspi.KeysWindowWorkspaceSetting.AcceptButton = btnOk;
wspi.KeysWindowWorkspaceSetting.CancelButton = btnCancel;
spi = wspi;
} else
spi = Activator.CreateInstance(smartPartInfoType) as ISmartPartInfo;
spi.Description = "Find a Region.";
spi.Title = "Find Region";
return spi;

I followed the exact method as in the BankBranchWorkbench, but my window displays in the topleft portion of the screen and does not show the title. The shell was generated using the SCSF and the view does contain the code for the modal window workspace in the Infrastructure.Layout Module.cs class.

WindowWorkspace wsp = new WindowWorkspace(_shellLayout.ParentForm);
_rootWorkItem.Workspaces.Add(wsp, WorkspaceNames.ModalWindows);

Nov 2, 2006 at 12:15 PM
originally posted by: dpadlewski

Figured it out, had to implement ISmartPartInfoProvider in my view class.