Print Page | Close Window

[SOLVED] Display a CAB UI modally

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=453
Printed Date: 11-Jun-2026 at 6:01pm


Topic: [SOLVED] Display a CAB UI modally
Posted By: mykel
Subject: [SOLVED] Display a CAB UI modally
Date Posted: 26-Sep-2007 at 11:16pm
Hello,
 
Do you know how to display a CAB UI page (which is normally displayed in the content workspace) modally with its Shell as its parent?
 
Thanks!
 
 



Replies:
Posted By: mykel
Date Posted: 27-Sep-2007 at 12:47am
Hello again,
 
I already implemented the way that the CAB UI page will be displayed with the use of the WindowWorkspace using the ff code:

WindowWorkspace wsp = new WindowWorkspace(ShellForm);

What happens is the CAB UI form displayed always on the top of the ShellForm, but can still manage to click and modify fields in the ShellForm.

Does this really the meaning of a "Modal" Window in CAB application? :) To what I expect is my CAB UI page should be displayed as dialog window and not be able to click behind it on other forms or on the main shell form. Help! hehe
 
Thanks a lot!
 
 


Posted By: Bill Jensen
Date Posted: 27-Sep-2007 at 1:58pm
Look at the SharedEditor module of the Cabana application.  I think it does what you want to do.
 
Bill J.


Posted By: mykel
Date Posted: 27-Sep-2007 at 6:10pm
Yep, it does but you are still allowed to click and modify the parent shell form, even if i set the page as always on the top of the parent form. I am looking for a way that the CAB page will behave like the ordinary dialog window that the code ShowDialog() does in a form. Is it possible to implement it using Cabana or CAB workspaces?


Posted By: Bill Jensen
Date Posted: 28-Sep-2007 at 10:37am
Sure.
 
Out of the box, the Cabana Foundation module (in FoundationModule.cs)
creates two instances of WindowWorkspace:
 

/// <summary>Window workspace to be used for Editor windows under the aegis of the shell's form.</summary>

/// <remarks>

/// Added by IdeaBlade

/// </remarks>

private void AddWindowWorkspace() {

// Add window workspace to be used for modal windows

WindowWorkspace wsp = new WindowWorkspace(ShellForm);

RootWorkItem.Workspaces.Add(wsp, WorkspaceNames.ModalWindows);

// Use the following if editor forms may hide behind the shell.

WindowWorkspace editorWorkspace = new WindowWorkspace();

// Use the following if editor forms should always be on top of the shell.

// WindowWorkspace editorWorkspace = new WindowWorkspace(ShellForm);

RootWorkItem.Workspaces.Add(editorWorkspace, WorkspaceNames.EditorWorkspace);

}

Simply set one of these as the workspace for your view before showing it.

Bill J.


Posted By: mykel
Date Posted: 30-Sep-2007 at 6:58pm
yup. Actually I have already implemented that. But either those two, I can still click and type behind the dialog window, even if the said window is always on top of the shell.


Posted By: mykel
Date Posted: 30-Sep-2007 at 11:42pm
I already made it work at last. I need to modify the methods in the WindowWorkspace class in the library in order to view it as a modal dialog. thanks!


Posted By: Bill Jensen
Date Posted: 01-Oct-2007 at 4:45pm
I'm curious why you needed to modify the WindowWorkspace class. 
 
Did you try setting the Modal flag in the CabWindowSmartPartInfo supplied to the WindowWorkspace before showing your view?
 
Bill


Posted By: mykel
Date Posted: 02-Oct-2007 at 12:16am
Yup i also have seen that as an alternative but I was not able to make it work. can you teach me how? :D
 
I considered modifying the WindowWorkspace because all our dialog windows should be viewed as a modal dialog, wherein the user should not be able to click behind.


Posted By: Bill Jensen
Date Posted: 02-Oct-2007 at 10:33am
I'd try this:
 
1.  Create a new CabWindowWorkspaceSmartPartInfo.
 
2. Set Modal = true
 
3.  Show the view in the window workspace., passing the smart part info as the second parameter.
 
Is this what you tried?
 
I believe that Ward designed the WindowWorkspace to support both modal and non-modal windows, as well as a number of other parameters.
 
If it doesn't work, post a snippet of your code and we'll look at it.
 
Bill J.
 


Posted By: mykel
Date Posted: 02-Oct-2007 at 7:59pm

thanks for this, bill.

Just got some problems, but i was able to find a solution for it. THanks!




Print Page | Close Window