Archived

This topic is now archived and is closed to further replies.

davekerr

A MFC Tab Question

Recommended Posts

I have derived a class from CTabCtrl, with the idea that the client could create a CDialogBar, then call my class''s Create function, passing the dialog bar as the parent. Then, the tab would stretch to fit the dialog bar. How can i do this!?! I tried calling GetClientRect and GetWindowRect on the dialog bar passed to my control in the controls Create and OnCreate functions, but they either give a rect that is (0, 0, 0, 0) or one that is not at all like the correct size. then i tried creating a new class, derived from CDialogBar, which (in a roundabout way) i added to my control class, so when it is created, the dialogbar member subclasses the dialog bar passed, and tells the special tab control when it receives OnSize messages. This caused loads of runtime errors. is there any message i can handle, something like WM_YOUR_PARENT_WINDOW_HAS_RESIZED so i can stretch my window to fit the dialog bar. I don''t want my clients to have to type m_wndTabBar.Create(pDialogBar, CRect(2, 4, 345, 23)); or whatever... thanks in advance!

Share this post


Link to post
Share on other sites
Hmm. I''m a little confused as to what you''re truly trying to do here in all honesty, but realistically you can tell the child views that you''re resizing. There are several ways to do this, one is to make a member variable in the parent class and post a message or call a function there, or you can do iterations in most parent windows to look at all the child windows it has, and pulling an IsKindOf would tell you which one to message to resize.

-fel

Share this post


Link to post
Share on other sites