| Author |
Share Topic Topic Search Topic Options
|
Bill Jensen
IdeaBlade
Joined: 31-Jul-2007
Location: United States
Posts: 229
|
Post Options
Quote Reply
Topic: [Resolved] TabShellLayout Posted: 22-Oct-2007 at 4:22pm |
Hi Dan,
You said:
I want to close a tab completely and then be able to reload it when the user selects that page again. And I am wondering the best way to do this.
I have tried .Close(mShellContentWorkspace.SmartParts[mShellContentWorkspace.SelectedTabPageIndex]);.
Yes, as Platt describes, Workspace.Close() removes the SmartPart from the workspace. You would probably have to replicate the composition logic from the page controller's Run() method in its ShowPage delegate, taking care not to create a new page every time its shown.
I really do not want it to hide, which I can do, because I want the data reloaded when the page is loaded again.
Why not? You could use some logic to determine if it's been hidden and if so, unhide it and refresh the contents of its data source.
Also, is there a way to access the TabControl from inside a module or outside form. (ie. close all tabs from an admin/options page)?
The shell layout view is registered as a SmartPart in the root workitem under the key
WorkspaceNames .ShellLayout
Bill J.
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 22-Oct-2007 at 3:05pm |
I am still working with the tabbedshelllayout.
I want to close a tab completely and then be able to reload it when the user selects that page again. And I am wondering the best way to do this.
I have tried .Close(mShellContentWorkspace.SmartParts[mShellContentWorkspace.SelectedTabPageIndex]);.
But when I do this and wish to load the page again it gives me an error because the SmartPart no longer exists.
I really do not want it to hide, which I can do, because I want the data reloaded when the page is loaded again.
Also, is there a way to access the TabControl from inside a module or outside form. (ie. close all tabs from an admin/options page)?
|
 |
Bill Jensen
IdeaBlade
Joined: 31-Jul-2007
Location: United States
Posts: 229
|
Post Options
Quote Reply
Posted: 08-Oct-2007 at 1:31pm |
Ward's Response:
I suspect that you are referring to the tab titles that appear when the Page content area is implemented with a TabWorkspace rather than a DeckWorkspace.
[aside: That's what we do in TabShellLayout.cs which is hiding as an excluded file in Cabana.Foundation.Views.Layout.]
You were betting that this the tab text title carried over from the NavBar title. That makes sense although it is by no means necessary that the tab title (which is brief and might be supplemented dynamically with something instance specific) should be the same as the nav bar item text (which could be fixed text and too long).
In any case, the PageController is decoupled from all navigation so it doesn't know about a NavBar title. I suppose we could have passed it into the PageController but I didn't like that approach. Clearly I figured that the author of a PageController should decide how to determine the Page name.
To control how a Page view displays in the page area, we must set the view's PageSmartPartInfo. I do this for you in the PageControllers (see CabanaLib) - see InitializeSmartPartInfo.
[aside: PageSmartPartInfo derives ultimately from CAB's SmartPartInfo which is the standard CAB mechanism for communicating extra configuration data to a View as it is about to be loaded into a Workspace.]
This InitializeSmartPartInfo virtual method sets the page name to the Title. Title is a virtual property of the PageController which, by default, shows the RootObjectTypeDisplayName. That too is a virtual property of the PageController that defaults to the name of the type of the root object (recall all pages have a root object - the thing that they are putatively about).
Users of the default ShellLayout from CabanaLib (e.g, DotNetShellLayout, DevExShellLayout, ... depending on the control suite) don't complain about this because the Page area is a DeckWorkSpace rather than a TabWorkSpace; no tabs, no tab title, no problem.
I'll leave it to you to figure out how you obtain page titles. If you override each PageController's Title property so that it returns that value, things should work out fine.
Dan's Response to Ward's Response:
Thank you Ward. Apparently I set the title before the initialization took affect so the title never changed. I decided to override the InitializeSmartPartInfo method in my PageController and it worked like a charm.
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 05-Oct-2007 at 10:19am |
|
SmartPartInfo doesn't exist in the PageController itself. I found the PageView.SmartPartInfo and tried to change the title there. It did not do anything.
|
 |
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 05-Oct-2007 at 9:52am |
That is a bit of a mystery, then.
SmartPartInfo.Title = "foo";
Would that work?
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 05-Oct-2007 at 9:31am |
|
That is for the actual TabControllers. Mine is the Page itself. I am using a TabLayout for my pages. So each Nav Menu item creates a new Tab Page.
|
 |
Linguinut
Senior Member
Joined: 14-Jun-2007
Location: United States
Posts: 394
|
Post Options
Quote Reply
Posted: 05-Oct-2007 at 9:12am |
In the view's tabcontroller:
/// <summary>Set the View's Tab's SmartPartInfo within the /// <see cref="TabViewController.ShowInTabWorkspace"/> phase.</summary> protected override TabSmartPartInfo SetSmartPartInfo() { return SmartPartInfoFns.MakeTabSmartPartInfo("Addresses", "Customer Addresses", true); }
Hope that helps.
|
 |
orcities
Senior Member
Joined: 28-Aug-2007
Location: United States
Posts: 454
|
Post Options
Quote Reply
Posted: 05-Oct-2007 at 7:32am |
In a different thread I got off track and started asking about tabs, so I started a new thread to discuss this.
I am using the TabShellLayout, that Ward was generous enough to give us, and I am curious as to how the tab display name is set.
I have noticed that it is not the same value as the nav bar as one might thing. It apparently is set somewhere else.
Does anyone know where this might be?
Edited by orcities - 30-Oct-2007 at 12:56pm
|
 |