Re: CTabCtrl in CSplitterWindow
"Alain Rist" <[email protected]>
| Newsgroups | gmane.comp.windows.wtl |
|---|---|
| Message-ID | <DFD34FE417524E1AA488EF01CB5610ED@Alain2> |
Hi Jochen,
in stdafx.h
#define _WIN32_WINNT 0x0600
instead of CTabCtrl use:
// CMyTabCtrl: explicit handling of WM_ERASEBKGND when themed
#include <atltheme.h>
class CMyTabCtrl :
public CWindowImpl<CMyTabCtrl, CTabCtrl>,
public CThemeImpl<CMyTabCtrl>
{
public:
DECLARE_WND_SUPERCLASS(_T("MyTabCtrl"), CTabCtrl::GetWndClassName())
CMyTabCtrl()
{
SetThemeClassList(VSCLASS_TABSTYLE);
}
BEGIN_MSG_MAP(CMyTabCtrl)
CHAIN_MSG_MAP(CThemeImpl<CMyTabCtrl>)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackground)
END_MSG_MAP()
LRESULT OnEraseBackground(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
if (IsThemingSupported())
{
RECT rc = {0};
GetClientRect(&rc);
DrawThemeBackground((HDC)wParam, TABP_PANE, TIS_NORMAL, &rc);
}
else
bHandled = FALSE; // not handled
return 1;
}
};
// in CMainFrame declaration
CMyTabCtrl mTab1, mTab2;
Not very pleasant solution, but working.
cheers,
AR
----- Original Message -----
From: jochen.stier
To: [email protected]
Sent: Sunday, July 05, 2009 3:42 AM
Subject: [wtl] CTabCtrl in CSplitterWindow
I having a problem with a CTabCtrl in a CSplitterWindow when I am using Common Controls 6.0.0.0. The area where the tabs are located is not being redrawn properly when I move the splitter. The tabs themselves are redrawn but not the area next to them. Here is a picture of what I mean (http://www.geist3d.com/images/wtl.jpg). The code that produces this problem seems quite simple:
class FrmTest : public CFrameWindowImpl<FrmTest>
{
public:
DECLARE_FRAME_WND_CLASS(NULL, IDR_MAINFRAME)
BEGIN_MSG_MAP(FrmTest)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
CHAIN_MSG_MAP(CFrameWindowImpl<FrmTest>)
REFLECT_NOTIFICATIONS()
END_MSG_MAP()
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
CTabCtrl mTab1;
CTabCtrl mTab2;
CSplitterWindowT<false> mHorizontalSplitter;
}
LRESULT FrmTest::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
LRESULT lRes = DefWindowProc(uMsg, wParam, lParam);
CRect lRect;
GetClientRect(&lRect);
// Splitters
m_hWndClient = mHorizontalSplitter.Create(m_hWnd, lRect, NULL, 0, WS_EX_CLIENTEDGE);
mHorizontalSplitter.SetSplitterExtendedStyle(SPLIT_BOTTOMALIGNED);
mTab1.Create (mHorizontalSplitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE | TCS_BOTTOM);
mTab2.Create (mHorizontalSplitter, rcDefault, NULL, WS_CHILD | WS_VISIBLE );
TC_ITEM lTab;
lTab.mask = TCIF_TEXT;
lTab.pszText = _T("Scene");
lTab.cchTextMax = _tcslen(lTab.pszText);
mTab1.InsertItem(0,&lTab);
mTab2.InsertItem(0,&lTab);
lTab.mask = TCIF_TEXT;
lTab.pszText = _T("Petri");
lTab.cchTextMax = _tcslen(lTab.pszText);
mTab1.InsertItem(1,&lTab);
mTab2.InsertItem(0,&lTab);
mHorizontalSplitter.SetSplitterPanes(mTab1, mTab2);
UpdateLayout();
mHorizontalSplitter.SetSplitterPos(150);
mHorizontalSplitter.m_bFullDrag = false;
return 0;
}
This problem only occurs when I switch to Common Controls 6.0.0.0 in the stdafx.h. I.e. using
#pragma comment(linker, "/manifestdependency:\"type='win32'name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
Cheers
Jochen
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/wtl/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/wtl/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/