no zones in the workspace to display smart parts

Topics: CAB & Smart Client Software Factory
Dec 6, 2006 at 8:11 AM
originally posted by: mklapp

I set up a Shell Form.
I setup two splitters (the so-called Outlook Interface) and placed 3 Zone Workspaces, one within each split area.
When I ran this, I got what I expected: a basic menu and blank form.

I have added a Module with a Work Item, a user control, and Module Init.

I have tried two documented methods to display the User control in the ZoneWorkspace.

One, in the Module's Work Item:

protected override void OnRunStarted()
srAppEntry srP = this.SmartParts.AddNew<srAppEntry>();

The other in WorkItem.Show() :

public void Show(IWorkspace content)
registrationWorkspace = content;
srAppEntry regView = this.Items.AddNew<srAppEntry>();
// (srAppEntry is the Smart Part UserControl)

The OnRunStarted method never ever runs.

The WorkItem.Show method returns the following exception.

Failed to load module from assembly SESRegistration. Error was:
Failed to load module from assembly SESRegistration, Version=1.0.2530.18842, Culture=neutral, PublicKeyToken=null. Error was:
There are no zones in the workspace to display smart parts.

the reference to registrationWorkspace references the correct ZoneWorkspace (found on the Shell form inside one of the splitter ares (no panels used in Shell Form).

All the Zone Workspaces have names.

What am I doing wrong?


Dec 6, 2006 at 9:34 AM
originally posted by: Jrad

I'm sorry if my response is so dumb, but you have added the name of your DLL to profilecatalog.xml, as I got caught by this some time ago!!

Sorry if I posted the obvious.
Dec 6, 2006 at 10:26 AM
originally posted by: mklapp

Yep, got that one.

I have been stepping through the CAB code the better part of the last two days. I still do not understand everything I am seeing but the immediate cause of the error is :

zonesByName.Count == 0 in the method ZoneWorkspace.OnShow

Everything seems to be located by the code except for a named zone. The ZoneWorkspaces all have names, so there is probably either another ZoneWorkspace (unlikely?) or there is a step (like setting the MainMenuStrip Property for the Shell Form) that is required but not documented or I have made an undetected error.

Thanks for the effort, I appreciate it.
Dec 6, 2006 at 12:46 PM
originally posted by: JKraft4PIT

I personally haven't tried out zone workspaces yet but in the help it says this:

"This workspace is intended to be used in a designer. If programmatic manipulation of zone definition is required, instead of directly adding zones to the Zones property, the following operations should be performed in order to get proper behavior:

1 - The control must be added as a child control of the workspace, probably inside a splitter container.

2 - The SetZoneName must be called passing the control and the desired zone name."

Also the help says this about "SetZoneName"

public void SetZoneName (
Control target,
string name

Control to set the zone name to.

The name of the zone to assign to the control."

Just a thought.

Dec 7, 2006 at 6:25 AM
originally posted by: mklapp

And it is a good thought too. I had a little trouble understanding exactly what they were saying there.

I did use the designer to place the zones on the shell form, one inside each space delineated by the splitters. Each of these ZoneWorkspaces was assigned a name in the property boxe for the ZoneWorkspace control. In the overriden Load() method of the Module Init, I get a reference to the ZoneWorkspace(zws) I want:

registrationWorkspace = workItem.WorkspacesWorkspacesConstants.TOP_ZONE;

Then in WorkItem.Show (for the module) :

srAppEntry regView = this.Items.AddNew<srAppEntry>();

Which in turn produces an exception:

There are no zones in the workspace to display smart parts.

As to the documentation, it is not clear what the Zones property is a part of. It seems to suggest that a ZWS can have several Zones. But it does not seem as though I should define a Single Zone, lay splitters on top of that and define each of the resulting areas as zones within the zws.

Also, when it says 'the control must be added as a child control of the workspace' what do they mean? Are they referring to the SmartPart control in the module or the splitter control? I thought I was doing that above with:

srAppEntry regView = this.Items.AddNew<srAppEntry>();

Are we saying I should:

srAppEntry regView = this.Items.AddNew<srAppEntry>();
SetZoneName(regView, "zwsTop");

I just tried it and still got:

There are no zones in the workspace to display smart parts.

I have also tried:

srAppEntry regView = this.Items.AddNew<srAppEntry>();

regView.Parent = registrationWorkspace;
registrationWorkspace.SetZoneName(regView, "zwsTop");
and got:
A circular control reference has been made. A control cannot be owned by or parented to itself.

As well as :

srAppEntry regView = this.Items.AddNew<srAppEntry>();

regView.Parent = registrationWorkspace;
Resulting in:

There are no zones in the workspace to display smart parts.

I do appreciate the thought. Thank you.

Dec 9, 2006 at 10:01 AM
originally posted by: mklapp

Ok, after spending quite a bit of time trying to work this out, can anyone tell me whether they have ever gotten the ZoneWorkspace to work? Right now I am having doubts and would like to know that someone, anyone has gotten the 'out of the box' version of the Zone Workspace to work. Some comments on how you defined the workspace, how you set the zone name and what you set the Parent properties to would also be helpful.

At the very least, I would like to know the ZoneWorkspace is not (or is) just Vaporware.


Dec 9, 2006 at 11:36 AM
originally posted by: mklapp

OK, I got it.

First of all, special Thanks to Matias Woloski for learning the answer and then sharing it. See the URL:

It is good.

I was getting the model backwards. Instead of placing a zoneWorkspace on each split container panel, only one ZoneWorkspace is placed on the naked form. The split containers are laid on top of the zws. Each of the resulting panels then has their ZoneName property set to a value which is NOT the zws name, but another, presumably unique, name. In the call:

registrationWorkspace.Show(regView, new ZoneSmartPartInfo("zwsTop"));

registrationWorkspace is the zws and zwsTop is the zone name (NOT a ZoneWorkspace) assigned to the top, right panel which then contains the SmartPart.

Thanks again Matias, wherever you are!