Click to See Complete Forum and Search --> : How to Clone MS Tabbed Dialog Control


Keith Rule
May 26th, 1999, 03:25 PM
I'm trying to clone the Microsoft Tabbed Dialog Control in an MFC ActiveX control [I have special look and feel requirement]. I've been able to subclass SysTabControl32 and get access to all the behavior I want with one big exception.

The MS Tabbed Dialog Control available in VB6 somehow knows which tab another control was placed on. As you select different tabs, the controls you placed on them in design mode appear and disappear based on the selected tab without any programming. I'm stumped at how to make this behavior work in my control. Any ideas?

Thanks,

Keith

Keith Rule
June 2nd, 1999, 07:24 PM
Okay I figured this out. In the unlikely event that someone else cares, here's what you do.

When you create the MFC Active X control be sure to select "Acts as simple frame control".

You then need add the OnParentNotify(UINT message, LPARAM lParam) message support.

The high word of the first argument gives you the child id of the control being updated. The low word can be several message but WM_CREATE and WM_DESTROY tell you when a control is created or deleted.

Map a control to the current tab when it is created.
Save the tab/child id relationship in DoPropExchange.

You can convert the child ID to a CWnd pointer with the CWnd::GetDlgItem() method. All that you need to do once you have that is call ShowWindow(SW_SHOW) or ShowWindow(SW_HIDE) depending on the current tab selected.

That's it. It's pretty straightforward.

Keith