Hide

SftTabs/DLL 6.5 - Tab Control

Display
Print

InitializeTabControl

Initializes a tab control in a page. Activates the specified tab and the associated page.

C++

BOOL CSftTabsPage::InitializeTabControl(int iTab, CSftTabs* pTabCtl, CWnd* pFrame = NULL);

Parameters

iTab

The zero-based index of the tab to be made the active tab.

pTabCtl

A pointer to the tab control's CSftTabs based object.

pFrame

A pointer to a window's CWnd based object. This window will be used by SftTabs/DLL as client area for pages attached to the tab control. SftTabs/DLL uses this window's client area size and location as a replacement for the tab control's client area. The window described by pFrame may be hidden and/or disabled. If an application resizes or moves the frame window, the dependent page or Windows control also has to be resized by using the ResizePages function. Using this frame window, the client area of a tab control can be located anywhere in relation to the tab control even on a different dialog or window. This parameter may be NULL, in which case the tab control's client area is used for attached pages.

Returns

The return value is TRUE if the function was successful, otherwise FALSE is returned.

Comments

The InitializeTabControl function initializes a tab control in a page. Activates the specified tab and the associated page.

A page's tab control has to be initialized, which creates the page attached to the currently active tab. This is typically done in the OnInitDialog member function of the page.

This function is only used for pages which contain tab controls. A main tabbed dialog would use CSftTabsDialog::InitializeTabControl instead.

When a tabbed dialog is destroyed, all attached CSftTabsPage objects are automatically destroyed and deleted (using the C++ delete operator).

Example

This example initializes the tab control of a page and activates the second tab:

/////////////////////////////////////////////////////////////////////////////
// CPageDlg message handlers
BOOL CPageDlg::OnInitDialog()
{
    // call base class
    CSftTabsPage::OnInitDialog();
    int index;
    SFTTABS_TAB Tab;

    // Attach the tab control window to the CSftTabs object
    m_Tab1.SubclassDlgItem(IDC_P6_TAB1, this /* parent window */);

    ... additional tab initialization ...

    index = m_Tab.AddTab(_T("Si&xth"));
    m_Tab.SetTabInfo(index, &Tab5);
    m_Tab.SetTabDialog(index, new CPage6(this));/* tab page */
    m_Tab.SetControlInfo(&CtlInit);

    // Initialize tab control
    InitializeTabControl(1, &m_Tab, NULL);

    return FALSE;
}

See Also C/C++ API | C++ Classes | Notifications


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.