How to create a tab

There are two ways for you to create a tab in the Site Manager:

Create a tab from scratch

The only thing that your tab needs to do to be a legal Site Manager tab is to implement the tab view interface, ITabView. We cover the functions of the interface later in this chapter.

Copy another tab

The quickest way to create something in the Site Manager is to create a copy of something and then modify the copy. Tabs are no exceptions to this rule.

In the HelloWorld plugin we have tabs that were designed to be copied, meaning that they contain almost no extra functionality.

However there is nothing stopping you from copying another tab from somewhere else in the Site Manager. 

Functions overview

Base functions

This is a list of the functions in the ITabView interface:

Base functions

Description

void LoadData(
bool isRevert,
RecordIdentifier context,
object internalContext)

The function is called by the tabbed view via the tabControl.SetData(..) function.

isRevert parameter is the same parameter as the tabbed view gets and indicates whether the user is reverting or not.

context parameter is usually the ID of the object that is being edited by the tabbed view.

internalContext is usually the data object that the tabbed view is editing.

Note that the text above describes the usual setup but that is not always the case. Sometimes we do not have a context we are working with and sometimes the internalContext parameter is more complex. You need to view the tabControl.SetData() function of the tabbed view to see what it is really sending.

bool DataIsModified()

In this function you determine if the tab needs to be saved or not. Here you check to see if any of your data has been changed, and if it has this function should return true and then the SaveData() function will be called automatically.

bool SaveData()

Here you save the data in your tab. Please note that you NEVER call this function yourself, the Site Manager framework handles calling it at appropriate times.

void GetAuditDescriptors(

List<AuditDescriptor> contexts)

Connects the tab with an audit view. See chapter 3.7 Auditing for more details.

void OnDataChanged(..)

This function is described in the different kinds of Site Manager views.
The only thing that is different here from the functionality in the views is that the tabbed views are responsible for forwarding the message that they get to the tabs. They do this through the tabSheetTabs.BroadcastChangeInformation(..) function. From this function the tabs of the view are called.

void OnClose()

This function is used to clear any data when the tab is discarded. Usually you can leave this empty.

Tab instance

To be able to add your tab to a tabbed view, your tab needs to have a static method that returns a new instance of the tab, as exemplified below.

public static ITabView CreateInstance(object sender, TabControl.Tab tab)
{
	return new MyTabViewPage();
}

 

Next you learn how to create a tabbed view: How to create a tabbed view