TabWorkspace - Activate First Tab after all the modules loaded

Topics: CAB & Smart Client Software Factory
Jun 26, 2007 at 4:57 AM
Edited Jun 26, 2007 at 4:59 AM
I have a tabworkspace in my shell form. And I also have several modules which add their own views to the tab workspace. But the problem is after I loaded all the modules, it always selects the last loaded module (view) in the tab workspace. I would like to know how to activate the first tab after I loaded all the modules.

Thanks in advance.
soe moe
Jun 26, 2007 at 4:00 PM

SoeMoe wrote:
I have a tabworkspace in my shell form. And I also have several modules which add their own views to the tab workspace. But the problem is after I loaded all the modules, it always selects the last loaded module (view) in the tab workspace. I would like to know how to activate the first tab after I loaded all the modules.

Thanks in advance.
soe moe


The IWorkspace interface declares a method called Activate(smartpart). The workspace also maintains a list of smartparts added to it. So you can do this:

Workspaces"MyTabWorkspace".Activate(Workspaces"MyTabWorkspace".Smartparts0);

And that will activate the first smartpart that was added to the workspace, which should be in the first tab position (provided you haven't altered the tab positions with tabsmartpartinfo; I haven't tried to see what happens when you do that using this method).
Jun 27, 2007 at 3:36 AM
ChrisHolmes, Thx for your help..

but I would to know when I need to call Activate method. (which event.?) I have tried at "MyTabeWorkspace".ControlAdded event. It doesn't work.

And I haven't alter the tab positions with tabsmartpartinfo.
Jun 27, 2007 at 3:38 AM
oh.. I got it..

I used the ShellForm.Shown.

ChrisHolmes, Thanks a lot..!!!
Jun 28, 2007 at 4:14 PM
If using the standard tabworkspace you can also use TabSmartPartInfo.ActivateTab, set this property to false on all tabs that you do not want to be activated initially. That way you don't have to go back and reactivate the first tab =)