Showing SmartPart in MdiWorkspace the 2. time

Topics: CAB & Smart Client Software Factory
Dec 20, 2006 at 3:17 AM
originally posted by: RobertEwen

Hi,

i am using the MdiWorkspace and i have the following problem:

- I Show a SmartPart in the MdiWorkSpace

WorkItem.WorkspacesConstants.WorkspaceNames.LayoutWorkspace.Show(_homeView);

- I Close the SmartPart via the button, the MdiWorkspace is presenting

i retry opening the SmartPart with the same call

WorkItem.WorkspacesConstants.WorkspaceNames.LayoutWorkspace.Show(_homeView);

-> I get an empty mdiChild. No SmartPart is shown ...??

Does anybody know the problem?

Thx Robert
Dec 22, 2006 at 8:16 AM
originally posted by: JuanArg

Hi,
I think you are using the same instance of the view twice.
After the Workspace closes the view, it is hidden.
Try creating the view before showing it in the workspace.

_ homeView = this.SmartParts.AddNew<HomeView>();
WorkItem.WorkspacesConstants.WorkspaceNames.LayoutWorkspace.Show(_homeView);

I hope it would help you. If not, send a little more info of what you try to achieve.

Juan Arguello
http://staff.southworks.net/jarguello
Jan 5, 2007 at 12:14 AM
originally posted by: RobertEwen

Hi,

thx for the answers ...

You are right. And to solving it with recreating the view is working, but there seems to be a bug in this whole behaviour of MdiWorkspace.

I suggested the same behaviour as the other workspaces have. The view should be hidden and not disposed.
So there has to be a common way to show a view again and again without recreating it (cause maybe i don't want to, cause its might be expensive :-) ) ...

Well for now, it works ...

Best regards,
Robert
Jan 5, 2007 at 12:43 AM
originally posted by: AlexeyNayda

Hi,

About expensive recreation you are absolutely right! :-)

In the previouse post i made misprint. Instead of "In any case i've resolved the same problem with recreating the View!" I wanted to write "In any case i've resolved the same problem WITHOUT recreating the View!" :-)
So follow the link in previous post and will find how to solve your problem without recreating smartPart.

Take care,
Alexey
Jan 5, 2007 at 12:44 AM
originally posted by: AlexeyNayda

Hi,

Take a look on this thread:
http://www.gotdotnet.com/codegallery/messageboard/thread.aspx?id=22f72167-af95-44ce-a6ca-f2eafbf2653c&mbid=f095dc16-95cc-4b64-9229-3510390aa521&threadid=feacf3b6-3f0d-4162-925f-0974b25723cb

I think the suggestions i wrote there will help you. In any case i've resolved the same problem withOUT recreating the View!

Kind regards,
Alexey
Jan 5, 2007 at 12:49 AM
originally posted by: RobertEwen

:)

sharpen your mind ... i should have read the post nevertheless :-) Thx again !
I will try ...

regards
robert
Jan 5, 2007 at 12:56 AM
originally posted by: AlexeyNayda

you r welcome :-)
If you have any questions , feel free to ask me!

c ya,
Alexey