Pelles C forum

C language => Expert questions => Topic started by: halsten on May 04, 2008, 01:25:07 PM

Title: Tab Control Problem
Post by: halsten on May 04, 2008, 01:25:07 PM
I am creating a a form with a tab control, however am having problems navigating through the tabs. I attached the test form for others to check.
Title: Re: Tab Control Problem
Post by: DMac on May 05, 2008, 05:46:05 PM
There are two things that are causing problems:

1. The handles need to be static or global

2. Notify needs to be more specific:

Code: [Select]

case WM_NOTIFY:

if(hTab == ((LPNMHDR)lParam)->hwndFrom &&
TCN_SELCHANGE == ((LPNMHDR)lParam)->code)
{
dwlResult = SendMessage(hTab, TCM_GETCURSEL, 0, 0);

switch (dwlResult) {
case 0:
hwndTabHandle = hDlgLog;
break;

case 1:
hwndTabHandle = hDlgInformation;
break;

case 2:
hwndTabHandle = hDlgProtection;
break;

case 3:
hwndTabHandle = hDlgAdvancedProtection;
break;
}

ShowWindow(PrevSelTab, SW_HIDE);
ShowWindow(hwndTabHandle, SW_SHOW);

PrevSelTab = hwndTabHandle;

    return TRUE;
}