Hide

SftTabs/DLL 6.5 - Tab Control

Display
Print

InitializeTabControl

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

C++

BOOL CSftTabsDialog::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 tabbed dialog. Activates the specified tab and the associated page.

A tabbed dialog'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 tabbed dialog.

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 tabbed dialog and activates the second tab:

/////////////////////////////////////////////////////////////////////////////
// CMainDlg message handlers
BOOL CMainDlg::OnInitDialog()
{
    // call base class
    CSftTabsDialog::OnInitDialog();
    int index;

    /* Associate the tab control created from the dialog */
    /* resource with the C++ object. */
    m_Tab.SubclassDlgItem(IDC_TAB, this /* parent window */);

    /* Initialization is faster if we set redraw off */
    m_Tab.SetRedraw(FALSE);

    /* We are using new features */
    m_Tab.SetVersion(SFTTABS_6_5);

    ... additional tab initialization ...

    index = m_Tab.AddTab(_T("&Six"));
    m_Tab.SetTabInfo(index, &Tab5);

    // If you don't want to attach a page to the tab, the following is optional
    // m_Tab.SetTabDialog(index, new an_object_based_on_CSftTabsPage(this)); // tab page
    m_Tab.SetControlInfo(&CtlInit);

    // Make sure to turn redraw back on
    m_Tab.SetRedraw(TRUE);
    m_Tab.InvalidateRect(NULL, TRUE);

    // If you are not using the sheet/page classes, remove the ...
    // 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.