NO

Author Topic: Tab Control Problem  (Read 3637 times)

halsten

  • Guest
Tab Control Problem
« 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.

Offline DMac

  • Member
  • *
  • Posts: 272
Re: Tab Control Problem
« Reply #1 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;
}
No one cares how much you know,
until they know how much you care.