Modal View Problem

Topics: CAB & Smart Client Software Factory
Jan 24, 2007 at 10:49 PM
I want to have it that when a user clicks on a listview, it brings up a seperate modal window to allow them to edit it as opposed to allowing them to edit it in the workspace. I have found very little at all on Modal windows, and the only walkthrough/quickstart that does anything like what I want to do is the Appraiser Workbench, but that uses ShowDialog, which I don't have access too. Here's the code I pieced together from the little I could find:

MyView child = WorkItem.SmartParts.Get<MyView>("MyView");
if (child == null)
{
child = WorkItem.SmartParts.AddNew<MyView>("MyView");
}

WorkItem.WorkspacesWorkspaceNames.ModalWindows.Show(child);

When I run it, it says "The Object reference is not set to a reference of an object". The only thing I can find that's null is: WorkItem.WorkspacesWorkspaceNames.ModalWindows null

Is there something special I need to do if I am working with Modal windows? Child gets a View, so that's definitely not null. Anyone have any ideas?
Jan 25, 2007 at 12:23 AM
Yes I stumbel over the same.
Have you build your SCSF shell without a seperarate layout ?
do so and ' WorkItem.WorkspacesWorkspaceNames.ModalWindows' return != null :-)

uwe
Jan 25, 2007 at 1:23 AM
There is a page about Modal Windows on cabpedia.com see
http://www.cabpedia.com/index.php?title=Consistentmodaldialogs#Displaythedialog

Uwe Lesta
Jan 25, 2007 at 1:28 AM
The disability to edit my own post is a nightmare. Sorry
http://www.cabpedia.com/index.php?title=Consistentmodaldialogs
Jan 25, 2007 at 1:34 AM
These fucking editor

title=Consistentmodaldialogs

type it in one line <underscore> means the single character.

Consistent<underscore>modal<underscore>dialogs

http://www.cabpedia.com/index.php?title=Consistentmodaldialogs
Jan 25, 2007 at 3:22 AM
Ahhh, do you need to actually use the smartpartinfo to generate the workspace? I guess since the root workspace has a layout already, it doesn't need it, but if you create a separate modal workspace you need to provide it with the properties it needs, which is probably why it is giving the error.

Thanks so much Uwe, I appreciate it. I've never seen this Cabpedia either, so I'll definitely take a look at that as well. Cheers!

And I totally sympathize with the lack of the edit button. This forum could definitely use some more features.

Jan 25, 2007 at 5:41 AM
When it says '// NOTE: work only 'out-of-the-box' if your generate your SCSF Shell with a seperate Layout' does 'out-of-the-box' mean outside the rootworkspace? And when it says 'if you generate your SCSF Shell "with" a separate layout' does it mean if you generate with a Infrastructure.Layout? I am not using an Infrastructure.Layout...
Jan 25, 2007 at 8:49 AM
Hi,

In the wizard to generate a SCSF projet is a check box where you configure if you want to add the layout of your shell into a seperate module or not.
Do a simple test :
generate 2 SCSF projekts. the first one with this option on the second off.

As far as i know.
in the first one ( layout in a seperate module ) you can access WorkItem.WorkspacesWorkspaceNames.ModalWindows e.g. in the ModuleContoller.
in the second SCSF project WorkItem.WorkspacesWorkspaceNames.ModalWindows returns null.

Uwe Lesta