SftTabs/DLL 6.0

GetNextTab

Softel vdm, Inc.

Retrieves the index of the next tab about to become active.

C

int SftTabs_GetNextTab(HWND hwndCtl);

C++

int CSftTabs::GetNextTab() const;

Parameters

hwndCtl

The window handle of the tab control.

Returns

The return value is the index of the next tab about to become active.

Comments

The GetNextTab function retrieves the index of the next tab about to become active.

GetNextTab returns the index of the tab about to become active while processing a SFTTABSN_SWITCHING notification. The application can prevent the new tab from becoming active by sending a WM_CANCELMODE message to the tab control.

GetNextTab can also be used in a CSftTabsPage::AllowSwitch or CSftTabsWindowPage::AllowSwitch function, because these are called by the C++ class implementations while a SFTTABSN_SWITCHING notification is being processed.

GetNextTab can only be used while processing a SFTTABSN_SWITCHING notification.

Example

This example prevents the user from switching to tab 0:

C

case WM_COMMAND: {
    HWND hwndCtl = (HWND) lParam; 
    int id = LOWORD(wParam); 
    int code = HIWORD(wParam); 
    if (hwndCtl) { 
        switch (id) { 
        case IDC_TAB: 
            switch (code) { 
            case SFTTABSN_SWITCHING:// we're about to switch away from
                                    // the current page. If you need to know what the new
                                    // page will be use SftTabs_GetNextTab(hwndCtl).
                if (SftTabs_GetNextTab(hwndCtl) == 0) { 
                    SendMessage(hwndCtl, WM_CANCELMODE, 0, 0); 
                    break; 
                } 
                if (!SftTabs_DeactivatePage(hwndParent, hwndCtl)) {
                    // couldn't deactivate current page, so don't switch
                    SendMessage(hwndCtl, WM_CANCELMODE, 0, 0); 
                    break; 
                } 
            case SFTTABSN_SWITCHED:// we switched to a new page
                SftTabs_ActivatePage(hwndParent, hwndCtl, NULL, FALSE);
                break; 
            } 
            break; 
        } 
    } 
    break; 
   } 

C++

BOOL CPage2::AllowSwitch()
{
    if (m_pTabCtl->GetNextTab() == 0)) 
        return FALSE; 
    return TRUE; // Allow switching away from this page
}

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


Feedback / comments / error reports for this topic
© 2016 - Softel vdm, Inc. - www.softelvdm.com