Hide

SftTabs/DLL 6.5 - Tab Control

Display
Print

DeactivatePage

Deactivates or destroys a page.

C++

protected:
    virtual void CSftTabsWindowPage::DeactivatePage(CWnd* pParent, CSftTabs* pTabCtl, BOOL fFinal) = 0;

Parameters

pParent

The CWnd based object describing the tab control's parent window.

pTabCtl

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

fFinal

TRUE if the page must be destroyed or FALSE if the page can be hidden or destroyed.

Comments

The DeactivatePage function deactivates or destroys a page.

The CSftTabsWindowSheet class implementation calls this member function to destroy the window associated with a page or to make the page invisible.

If the page is destroyed, the page must be recreated when the user switches back to this page (see CSftTabsWindowPage::ActivatePage). This does save resources but may cause excessive wait times. It is up to your application to choose the most suitable method.

Not all CWnd derived classes are suitable to be destroyed multiple times while using the same C++ object. Some classes (once constructed) assume that an attached window is only created once, not multiple times as it could happen with SftTabs/DLL. If a class doesn't support multiple creation of its window, you have to use ShowWindow when the user switches away from the tab page (as shown in the example below).

Your CWnd based class must implement DeactivatePage.

Example

This example shows the suggested implementation of the DeactivatePage function:

void CYourPage::DeactivatePage(CWnd* pParent, CSftTabs* pTabCtl, BOOL fFinal)
{
    if (fFinal) {
        // You must destroy the window, the tabbed window (parent) is going away
        DestroyWindow();
    } else {
        // Hide the page. If you want, you could use DestroyWindow here too.
        // In that case you save resources and the window will be recreated
        // when the user switches back to this page
        ShowWindow(SW_HIDE);
        EnableWindow(FALSE);
    }
    // clear associated page in tab's control structure
    SftTabs_SetPageInactive(pTabCtl->m_hWnd);
}

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


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